All commands of docker compose can be found here
Pull service images.
docker compose pull --ignore-pull-failuresThis command pulls the latest images for the services defined in the docker compose.yml file from the remote registry, and ignores images with pull failures (--ignore-pull-failures). This is useful for updating images without rebuilding them
Pull what it can and ignore images with pull failures.
List active containers.
docker compose ps -aThis command lists all containers, including stopped ones (-a). It provides a quick overview of the current state of the containers managed by Docker Compose.
Display only container IDs.
Show all containers, including stopped ones.
Follow log output (live stream).
Output the last NUM lines.
View output from containers.
docker compose logs -f --tail=50 myserviceThis command displays the log output from the myservice container. It follows the log output in real-time (-f), and only shows the last 50 lines (--tail=50). This is useful for monitoring and debugging applications.
List running compose projects.
docker compose ls -aShow all compose projects, including stopped ones.
Build, (re)create, start, and attach to containers for a service.
docker compose up -d --buildThis command reads the docker compose.yml file, builds the images for the defined services if they don't exist or if the --build flag is used, creates and starts the containers in the background (-d flag), and detaches from them. This is a convenient way to start all services and their dependencies.
Detach and run containers in the background.
Build images before starting containers.
Scale the specified service to the desired number of replicas.
Run a one-off command on a service.
docker compose run --rm myservice python manage.py migrateThis command runs the python manage.py migrate command inside a new myservice container and removes the container after the command has finished executing (--rm). This is useful for running one-off tasks or scripts that should not interfere with the primary service container.
Remove container after run.
Do not start linked services.
Stop and remove containers, networks, images, and volumes.
docker compose down --rmi all -vThis command stops and removes containers, networks, all images used by any service (--rmi all), and named volumes (-v).
It is useful for cleaning up the environment and starting fresh.
Remove all images used by any service.
Remove named volumes.
Build or rebuild services.
docker compose build --no-cache myserviceThis command builds (or rebuilds) the myservice image without using cache (--no-cache).
It is helpful when you want to force a new build from scratch or when you've made changes to the Dockerfile or the context.
Always remove intermediate containers.
Do not use cache when building the image.
Always attempt to pull a newer version of the image.
Stop services.
docker compose stop myserviceThis command stops the myservice container without removing it. You can later start the container again using docker compose start.
Specify the service(s) to stop.
Start existing containers for a service.
docker compose start myserviceThis command starts the existing myservice container that was previously stopped. It is useful for resuming services without recreating containers.
Specify the service(s) to start.
Remove stopped containers.
docker compose rm -f -vThis command forcefully removes stopped containers (-f) and any anonymous volumes attached to them (-v). It is used for cleaning up stopped containers that are no longer needed.
Don't ask to confirm removal.
Remove any anonymous volumes attached to containers.
When you run docker-compose kill, it sends a SIGKILL signal to all the containers defined in your docker-compose.yml file, causing them to stop immediately. This is a more aggressive way of stopping the containers than using docker-compose down, which sends a SIGTERM signal to the containers and allows them to shut down gracefully.
docker compose kill -s SIGINTIf a container is stopped or removed outside of Docker Compose's control, it becomes an orphan container. This means that the container still exists on the system, but is not being managed by Docker Compose, and thus will not show up in docker-compose ps. This option will remove any orphan containers that are attached to the project-specific network.
SIGNAL to send to the container. Default is SIGKILL
Execute a command in a running container.
docker compose exec myservice ls /appThis command executes the ls /app command inside the running myservice container. It allows you to run arbitrary commands inside a specific container, which is helpful for debugging or managing the application within the container.
Disable pseudo-TTY allocation.
Specify the service and command to be executed.