I’ve getting started with Docker, using the LAMP repo from GitHub as my starting point. I need to add the libxslt
lib. I’ve tried adding this to my Dockerfile:
RUN apt-get install libxslt-dev
RUN docker-php-ext-enable libxslt-dev
But keep getting error: E: Unable to locate package libxslt-dev
I’ve tried to search for the lib from the Docker container’s command line apt-cache search libxslt
but get no results.
Can anybody point me in the right direction to get this lib installed?
Thanks
Followed answer below (@vpalmerini) updating Dockerfile
:
RUN apt update && apt-get install -y libxslt-dev
RUN docker-php-ext-enable libxslt-dev
Which I thought was working:
Step 9/13 : RUN apt update && apt-get install -y libxslt-dev
[…]
The following additional packages will be installed:
libxslt1.1
The following NEW packages will be installed:
libxslt1-dev libxslt1.1
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 756 kB of archives.
After this operation, 3001 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 libxslt1.1 amd64 1.1.32-2.2~deb10u1 [237 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 libxslt1-dev amd64 1.1.32-2.2~deb10u1 [519 kB]
Fetched 756 kB in 0s (4903 kB/s)
Selecting previously unselected package libxslt1.1:amd64.
(Reading database ... 21271 files and directories currently installed.)
Preparing to unpack .../libxslt1.1_1.1.32-2.2~deb10u1_amd64.deb ...
Unpacking libxslt1.1:amd64 (1.1.32-2.2~deb10u1) ...
Selecting previously unselected package libxslt1-dev:amd64.
Preparing to unpack .../libxslt1-dev_1.1.32-2.2~deb10u1_amd64.deb ...
Unpacking libxslt1-dev:amd64 (1.1.32-2.2~deb10u1) ...
Setting up libxslt1.1:amd64 (1.1.32-2.2~deb10u1) ...
Setting up libxslt1-dev:amd64 (1.1.32-2.2~deb10u1) ...
Processing triggers for libc-bin (2.28-10) ...
Removing intermediate container b62504aca3f9
---> b62b7af34467
Step 10/13 : RUN docker-php-ext-enable libxslt-dev
---> Running in 181191c74fe5
error: 'libxslt-dev' does not exist
Also tried changing RUN
command to match package found: libxslt1-dev
RUN docker-php-ext-enable libxslt1-dev
Still unable to enable libxslt
Further info, output from:
dpkg --get-selections
includes:
libxml2-dev:amd64 install
libxrender-dev:amd64 install
libxrender1:amd64 install
libxslt1-dev:amd64 install
libxslt1.1:amd64 install
libxt-dev:amd64 install
But running RUN docker-php-ext-enable libxslt1-dev
still gives
error: 'libxslt1-dev' does not exist
2
Answers
The only thing missing is that you have to update the packages of your image, then you will be able to install
libxslt-dev
package:You are confusing the php extension called
xsl
with the system development package forlibxslt
(present on your base image Debian Linux distribution with the specific namelibxslt1-dev
) which is required to install that php extension.Here is a basic Dockerfile to achieve your requirement. Note that, as a good practice, I made the install in a single run instruction with some extra cleanup at the end.
The
apt-get remove
line is optional but will reduce the layer size a bit more. Installinglibxslt1-dev
and all its dependencies (icu-devtools
,libicu-dev
,libicu63
,libxml2
,libxml2-dev
,libxslt1.1
) is mandatory for installing the extension. But once it is done, the dev packages can be removed.