0

Because I want PHP 7.3 features I am trying to update the project from PHP 7.2 to PHP 7.3. Within docker-compose.yml I have:

php:
    build: ./docker/php
    volumes:
        - .:/var/www/html
    links:
        - mysql:mysql
    depends_on:
        - mysql
    networks:
      - pimcorenet

My Dockerfile is like:

FROM php:7.2-fpm

# install git
RUN apt-get update && \
        apt-get install -y --no-install-recommends git

#install some base extensions
RUN apt-get install -y \
        zlib1g-dev \
        zip \
        libpng-dev \
        exiftool \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libicu-dev \
        libpq-dev \
        libxpm-dev \
        libvpx-dev \
        mariadb-client \
        libxml2-dev

RUN docker-php-ext-install -j$(nproc) \
        zip \
        exif \
        bcmath \
        intl \
        pcntl \
        mysqli \
        pdo \
        gd \
        pdo_mysql \
        pdo_pgsql \
        mbstring \
        soap \
        opcache \
        iconv

# Install Imagick
RUN apt-get update && apt-get install -y \
    libmagickwand-dev --no-install-recommends \
    && pecl install imagick \
    && docker-php-ext-enable imagick

# Install Composer
RUN echo "Install Composer"
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer --version

I am getting the following error:

E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/r/readline/readline-common_7.0-5_all.deb Could not resolve 'cdn-fastly.deb.debian.org' E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/j/jquery/libjs-jquery_3.3.1~dfsg-3_all.deb Could not resolve 'cdn-fastly.deb.debian.org' E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/f/freetype/freetype2-doc_2.9.1-3_all.deb Could not resolve 'cdn-fastly.deb.debian.org' E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/i/icu/icu-devtools_63.1-6_amd64.deb Could not resolve 'cdn-fastly.deb.debian.org' E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/j/javascript-common/javascript-common_11_all.deb Could not resolve 'cdn-fastly.deb.debian.org' ..... more errors

ERROR: Service 'php' failed to build: The command '/bin/sh -c apt-get install -y zlib1g-dev zip libpng-dev
exiftool libfreetype6-dev libjpeg62-turbo-dev
libmcrypt-dev libicu-dev libpq-dev libxpm-dev libvpx-dev mariadb-client libxml2-dev' returned a non-zero code: 100

What is the exact problem with this? Is it because some required PHP extensions are not yet available for PHP 7.3 or have been replaced? How do I resolve this? Just changed FROM php:7.2-fpm to FROM php:7.3-fpm.

Blackbam
  • 17,496
  • 26
  • 97
  • 150

1 Answers1

2

You are failing to grok containers. And because of that you are taking the wrong approach.

You shouldn't be trying to 'upgrade' a php 7.2 to container to 7.3.

You should be creating a new container image that is based off 7.3 to begin with.

Incidentally, I would recommend making it me a new, separate service to your existing 7.2 container, i.e. a new Dockerfile, rather than just changing the existing container/Dockerfile. That will allow you to test the two versions alongside each other, rather than having a 'leap of faith' change over.

Also, I'd recommend building off the Debian or Ubuntu images directly, rather than going through the 'official' Docker images. They are only official in the sense of being made by Docker, but they are not quite as well supported in my opinion.

This is the dockerfile I'm using currently: https://github.com/Danack/example/blob/master/docker/php_fpm/Dockerfile Switching 7.2 to 7.3 should 'just work'.

Danack
  • 24,939
  • 16
  • 90
  • 122