Docker Community Forums

Share and learn in the Docker community.

Docker PHP 7.3 packages has unmet dependencies

I haven’t been run any update for few months and now my Dockerfile has become broken for some reason.

    FROM digitonic1/php7.3-nginx:stable

    RUN echo "deb http://security.debian.org/debian-security buster/updates main" | sudo tee /etc/apt/sources.list.d/docker.list
    
    
    RUN rm /var/lib/apt/lists/* -vrf && \
        apt-get clean && apt-get autoclean && apt-get update
    
    RUN sudo apt-get install -y php7.3-dev
    
    RUN sudo pecl install msgpack
    RUN sudo pecl install grpc-1.27.0
    RUN sudo pecl install protobuf
    
    RUN echo extension=msgpack.so >> /etc/php/7.3/fpm/php.ini
    RUN echo extension=msgpack.so >> /etc/php/7.3/cli/php.ini
    
    RUN echo extension=grpc.so >> /etc/php/7.3/fpm/php.ini
    RUN echo extension=grpc.so >> /etc/php/7.3/cli/php.ini
    
    RUN echo extension=protobuf.so >> /etc/php/7.3/fpm/php.ini
    RUN echo extension=protobuf.so >> /etc/php/7.3/cli/php.ini
    
    # Clean Build Depencies
    RUN  apt-get remove -qq -y clang make cmake libssl-dev libz-dev php-dev libgmp-dev \
         && apt-get auto-remove -qq -y \
         && apt-get clean
    
    # Install node npm
    RUN curl -sL https://deb.nodesource.com/setup_12.x > /tmp/install-node.sh \
     && bash /tmp/install-node.sh \
     && apt-get update -qq -y \
     && DEBIAN_FRONTEND=noninteractive apt-get -qq -y --no-install-recommends install \
        nodejs \
        rsyslog \
        sudo \
        php-sqlite3 \
     \
     # Configure Node dependencies \
     && npm config set --global loglevel warn \
     && npm install --global marked \
     && npm install --global node-gyp \
     && npm install --global yarn \
     \
     # Install node-sass's linux bindings \
     && npm rebuild node-sass \
     \
     # Clean the image \
     && apt-get remove -qq -y pkg-config libmagickwand-dev build-essential \
     && apt-get auto-remove -qq -y \
     && apt-get clean \
     && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    
    
    COPY ./tools/docker/etc/ /etc/
    COPY ./tools/docker/usr/ /usr/
    
    COPY . /app
    WORKDIR /app
    
    RUN container build

First I was getting php7.3-dev not found, then I added this line to get it back

RUN echo "deb http://security.debian.org/debian-security buster/updates main" | sudo tee /etc/apt/sources.list.d/docker.list

But now I can’t get it to install, errors I’m getting:


     > [ 4/24] RUN sudo apt-get install -y php7.3-dev:
    #7 0.356 Reading package lists...
    #7 1.353 Building dependency tree...
    #7 1.496 Reading state information...
    #7 1.559 Some packages could not be installed. This may mean that you have
    #7 1.559 requested an impossible situation or if you are using the unstable
    #7 1.559 distribution that some required packages have not yet been created
    #7 1.559 or been moved out of Incoming.
    #7 1.559 The following information may help to resolve the situation:
    #7 1.559
    #7 1.559 The following packages have unmet dependencies:
    #7 1.675  php7.3-dev : Depends: libpcre2-dev (>= 10.30) but it is not going to be installed
    #7 1.675               Depends: libssl-dev but it is not going to be installed
    #7 1.675               Depends: php7.3-cli (>= 7.3.29-1~deb10u1) but it is not going to be installed
    #7 1.694 E: Unable to correct problems, you have held broken packages

Help appreciated!

Good evening,
not a solution but maybe a reason for your issue:
You are trying to use the Debian-Buster (=Debian 10) repository for a Ubuntu-Xenial-based (=Ubuntu 16.04) image which might cause some problems…

Why are you using this base-image digitonic1/php7.3-nginx:stable (which received its last update 10 months ago - in addition PHP 7.3 is only supported until 6th of December 2021) and pack all other things into it?
Why not multiple images/containers - each with a specific use? One for the data, one for nginx, one for php and one for node.

1 Like

I got the original dockerfile from github project for laravel framework in kubernetes and it uses this same image. I could update to other more recent 7.3 image until I upgrade whole PHP version. But currently I’m stuck with this one.

Unfortunately there is no xenial repo that contains php7.3-dev, at least I haven’t found one yet.