I want to extend the httpd Image with PHP and some PHP Modules. My Dockerfile for this looks like this.
FROM httpd:2.4
COPY forma.conf /etc/apache2/sites-available/
RUN apt-get update && apt-get install -y
nano
software-properties-common
RUN LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt-get -y update && apt-get install -y
php7.2
libapache2-mod-php7.2
php7.2-common
php7.2-mysql
php7.2-gmp
php7.2-ldap
php7.2-curl
php7.2-intl
php7.2-mbstring
php7.2-xmlrpc
php7.2-gd
php7.2-bcmath
php7.2-xml
php7.2-cli
php7.2-zip
The error I’m getting when building the Image is following
What am I´m doing wrong?
Edit:
Thanks to @RJK
On step 5/6 your are running add-apt-repository -y ppa:ondrejphp, it should be add-apt-repository -y ppa:ondrej/php (forward slash)
Now the script can find the ppa, but there is another error.
2
Answers
The httpd image is based on Debian and the ondrej repo is designed for Ubuntu, the two are related but it is going to cause you problems.
When add-apt-repository runs it adds the PPA for your current system version, the httpd image is using Debian buster which is equivalent to Ubuntu hirsute (21.04) which isn’t released and there is no packages in the PPA for it.
You can work around this by doing the import manually and specifying an ubuntu version (groovy in this case):
However you are just going to run into further problems. I would recommend starting with an Ubuntu base and installing everything you need:
It’s worth noting that there is a warning about setting the correct locale in the PPA description, it should be:
LC_ALL=C.UTF-8
I would recommend you start with this specific Dockerfile and install everything you need:
GOOD, LUCK!
@syedasadrazadevops