Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the 8.0 image the PHP version in the container is 8.1 #314

Closed
korridor opened this issue Jan 18, 2022 · 6 comments · Fixed by #316
Closed

Using the 8.0 image the PHP version in the container is 8.1 #314

korridor opened this issue Jan 18, 2022 · 6 comments · Fixed by #316
Labels

Comments

@korridor
Copy link

korridor commented Jan 18, 2022

  • Sail Version: 1.12.12
  • Laravel Version: 8.80.0
  • PHP Version: 8.0.12
  • OS: macOS 12.0.1

Description:

I use the 8.0 docker image, but after rebuild with sail build --no-cache the php version in den container is 8.1.1 (sail php -v).

The relevant lines from my docker-compose.yml file:

# For more information: https://laravel.com/docs/sail
version: '3.9'
services:
    laravel.test:
        build:
            context: ./docker/8.0
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.0/app
        extra_hosts:
            - 'host.docker.internal:host-gateway'

I freshly published the resources with artisan sail:publish.

Steps to Reproduce

  1. Install laravel curl -s "https://laravel.build/example-app" | bash
  2. Replace 8.1 with 8.0 in docker-compose.yml
  3. Run sail build --no-cache
  4. sail up -d
  5. sail php -v outputs 8.1.1
@luilliarcec
Copy link

Same issue

@brandonjjon
Copy link

brandonjjon commented Jan 18, 2022

Same issue here, looks like there's also a /usr/bin/php8.0 which is the correct version. Changing line 8 in the vendor/laravel/sail/runtimes/8.0/supervisord.conf file to reference /usr/bin/php8.0 and then running a sail build fixed the issue for me, but modifying files in the vendor dir is obviously not the best approach. Will wait for an official fix, hopefully gets you by in the meantime!

@tonysm
Copy link
Contributor

tonysm commented Jan 18, 2022

Looks like php8.0-dev is causing PHP 8.1 to be installed as well.

Screenshots without `php8.0-dev`

List of PHP extensions without php8.0-dev
Only 8.0 PHP stuff is being installed

Screenshots with `php8.0-dev`

image
image

As I see it right now, we could add a apt-get remove php8.1* step to the 8.0 runtime Dockerfile, and that should work. But I think it's weird that php8.0-dev adds PHP 8.1 stuff, so there might be an issue with the extensions or in the PPA.

@felliper
Copy link

felliper commented Jan 18, 2022

Same issue. In my temporary fix I added in the Dockerfile, after line 46: RUN update-alternatives --set php /usr/bin/php8.0

This way composer will work too.

@korridor
Copy link
Author

I tried the solution of @felliper and it worked for me. Now sail php -v gives me version 8.0.14.
Thanks for the fast quick fix!

@mist-01
Copy link
Contributor

mist-01 commented Jan 19, 2022

Looks like php8.0-dev (required in the docker file) recommends (recommends are installed by default) pkg-php-tools which in turn depends on php-pear and in turn php-8.1-cli:

apt-cache depends php8.0-dev
Depends: autoconf
  Depends: automake
  Depends: libpcre2-dev
  Depends: libssl-dev
  Depends: pkg-config
  Depends: php8.0-cli
  Depends: php8.0-common
  Depends: shtool
  Depends: libtool
  Recommends: pkg-php-tools

apt-cache depends pkg-php-tools
pkg-php-tools
  Depends: debhelper
  Depends: php-pear
  Depends: <php-cli>
    php8.0-cli
    php8.1-cli
  Depends: php-json
  Depends: <php-xml>
    php8.0-xml
  Suggests: <dh-make>

apt-cache depends php-pear
php-pear
  Depends: <php-cli>
    php8.0-cli
    php8.1-cli
  Depends: php-common
  Depends: <php-xml>
    php8.0-xml
  Breaks: <php-pear-frontend-gtk>
  Breaks: <php-pear-frontend-web>

Running the following command is a workaround (but will need to be re-run anytime the container is rebuilt):
docker-compose exec apt-get remove php8.1-cli

Adding a "–no-install-recommends" to the apt-get on line 24 of vendor/laravel/sail/runtimes/8.0/Dockerfile might be a solution if nothing else in sail requires php-pear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants