Friday, 9 August 2019

Unable to Install PHP Zip Module via Docker Build

I'm running into an issue with Docker images. I'm using the base image FROM ubuntu:16.04, and installing the following packages on it:

RUN apt-get -y install apache2
RUN apt-get -y install php7.0
RUN apt-get -y install libapache2-mod-php7.0
RUN apt-get -y install php7.0-mysql
RUN apt-get -y install php7.0-gd
RUN apt-get -y install php-pear
RUN apt-get -y install php7.0-curl
RUN apt-get -y install php7.0-mbstrin
RUN apt-get -y install php-imagick
RUN apt-get -y install curl
RUN apt-get -y install lynx-cur
RUN apt-get -y install php7.0-zip
#RUN apt-get -y install php7.0-xsl

Long story, I need the php7.0-zip package to install, but doing a docker build -t [...] . with the above packages noted results in an image that doesn't have zip installed/enabled. There are no errors during the command, and at a glance, everything seems to have gone ok.

Looking at the output of the command, I can see that it is properly downloading and attempting to install libzip4 and zip (libzip4, or zlib, is a dependency that is installed along with php7.0-zip):

The following NEW packages will be installed:
  libzip4 php7.0-zip 
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 56.1 kB of archives.
After this operation, 186 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial/universe amd64 libzip4 amd64 1.0.1-0ubuntu1 [36.3 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64  php7.0-zip amd64 7.0.15-0ubuntu0.16.04.4 [19.9 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 56.1 kB in 0s (123 kB/s)

Selecting previously unselected package libzip4:amd64.
(Reading database ... 13491 files and directories currently installed.)
Preparing to unpack .../libzip4_1.0.1-0ubuntu1_amd64.deb ...
Unpacking libzip4:amd64 (1.0.1-0ubuntu1) ...

Selecting previously unselected package php7.0-zip.
Preparing to unpack .../php7.0-zip_7.0.15-0ubuntu0.16.04.4_amd64.deb ...
Unpacking php7.0-zip (7.0.15-0ubuntu0.16.04.4) ...
Processing triggers for libapache2-mod-php7.0 (7.0.15-0ubuntu0.16.04.4) ...
Processing triggers for php7.0-fpm (7.0.15-0ubuntu0.16.04.4) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of restart.
Setting up libzip4:amd64 (1.0.1-0ubuntu1) ...
Setting up php7.0-zip (7.0.15-0ubuntu0.16.04.4) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline

Creating config file /etc/php/7.0/mods-available/zip.ini with new version
Processing triggers for libc-bin (2.23-0ubuntu7) ...
Processing triggers for libapache2-mod-php7.0 (7.0.15-0ubuntu0.16.04.4) ...
Processing triggers for php7.0-fpm (7.0.15-0ubuntu0.16.04.4) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of restart.
---> fe12c0bd06fd
Removing intermediate container 7cadeb2256d0

There's a couple of notices, but nothing fails. After pushing to gcloud and downloading to a local project, running a phpinfo() after configuring and connecting to the image results in the following:

enter image description here

In this image, there is no zip module enabled. For reference, another, local installation of PHP that has zip enabled shows as this:

enter image description here

I've tried installing another packing following the same steps (php7.0-xsl) and after configuring and connecting, the xsl module is shown as enabled in phpinfo():

enter image description here

Has anyone ever encountered this case before? I don't know why zip isn't installing and I'm at a loss... I need the zip module for excel related functions, but I'm not sure what to do next. Any suggestions would be greatly appreciated.

If my whole Dockerfile is required, I will update.



from Unable to Install PHP Zip Module via Docker Build

No comments:

Post a Comment