How to install system packages in a project¶
All Divio projects are based on a
Dockerfile that starts with base image that includes Linux.
If your project requires particular system packages, you can include them in
the Docker image, by listing the commands required to install them - typically,
RUN apt-get - in the
The commands in the
Dockerfile are executed in order, so an appropriate
place to put such commands is early on, after
FROM - for example, after:
and before any other commands that might depend on the package.
You should include an
apt-get update in the installation commands, and run
apt-get with the
-y (“Say yes”) option, for example:
RUN apt-get update RUN apt-get install -y postgresql-client
to install the
psql Postgres client.
To rebuild the docker image, installing the new packages:
docker-compose build web
The build output will show the new
RUN instructions being executed as part
of your build.