Docker
Adding a custom php extension
In docker-compose.yml
, find the service that is running PHP (it's the service that you log into to run make dev
, normally called workspace
, or possibly php-container
).
Replace the image
key with the build
key below:
@@ -41,7 +41,9 @@ services:
workspace:
container_name: ${COMPOSE_PROJECT_NAME}-php
- image: registry.xalok.com/hml-docker-images/php-container:7.4-node16
+ build:
+ context: ./php
+ dockerfile: Dockerfile
In the php/
directory, create a Dockerfile
with these contents:
FROM registry.xalok.com/hml-docker-images/php-container:7.4-node16
RUN sudo apt-get update && sudo apt-get install -y libxslt-dev
RUN sudo -E docker-php-ext-install xsl
Note: In the FROM
line, put whatever was in the docker-compose.yml
image
key (maybe your project uses a different version, not the 7.4-node16
that is shown this example).
Note: The above example installs the xsl
extension. This requires installing the libxslt
package. Replace the two RUN
commands with whatever commands are needed to install the extension you need.
Note: The same process can be used to install additional CLI tools. Replace the two RUN
commands in the example with whatever commands are needed to install the tools you need.
Then it's needed to stop the docker containers. The extension should be available when you next start them.