Docker

Installing Docker and Docker Compose

Prerequisites

nothing

You need to install

If not the case, add yourself to the docker group with

sudo usermod -aG docker $(whoami)

For the changes to take effect, you need to log out and log back in again.

Success

If docker compose config displays the current configuration

Setting environment variables

Prerequisites

This is best done using the .env file (see the compose docs).

cp example.env .env
sed -i "s/# *UID=.*$/UID=${UID}/" .env
sed -i "s/# *GID=.*$/GID=${GID}/" .env

Building the dev images

Prerequisites
docker buildx bake

Building the production images

Prerequisites

The tag of the images created by docker compose can be specified with the TAG environment variable, which defaults to latest, e.g.:

TAG=1.2.3 docker compose -f docker-compose.prod.yml build

This will tag all generated images with the tag 1.2.3.

Starting the containers

Prerequisites

The dev server and its dependent containers can be started by running

docker compose up --wait dev-app

If you run this command for the first time, this might take a while, as the images have to be built (see Building the dev images)

Success
  • If docker compose ps show dev- and test--services as UP

  • If logs show no errors (see Viewing logs)

Viewing logs

Prerequisites
docker compose logs # for all services
docker compose logs dev-app  # for one service
docker compose logs -f --tail=50 dev-app  # Print the last 50 entries and follow the logs

(Re-)building/Pulling images

Prerequisites

You can (re-)build/pull all images by running:

docker buildx bake --pull