Docker Compose

Commands to use Docker Compose

Start services defined in docker-compose.yml file:

sudo docker-compose up -d

This command builds, (re)creates, starts, and attaches to containers for a service in the background.

Stop services:

sudo docker-compose down

This command stops containers and removes containers, networks, volumes, and images created by up.

View logs for all services:

sudo docker-compose logs -f

This command shows the logs for all the containers, with the -f flag used for following the log output.

Scale the number of containers for a service

sudo docker-compose scale [SERVICE]=[NUM]

For example, if you want to run 3 instances of the web service, use:

sudo docker-compose scale web=3

List running containers:

sudo docker-compose ps

This command lists containers and their status defined in your Compose file.


Last modified February 19, 2025: Update azure-point-to-site-vpn.md (a9c807a)