Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude starting some containers with Docker Compose

Currently, I use Docker Compose to start multiple containers in one shot. I have containers started and running already, but while doing docker-compose up -d, I just want to exclude some containers while taking other containers up or down.

like image 925
Boopaathy Avatar asked Aug 17 '16 17:08

Boopaathy


People also ask

How do I stop a docker container from starting?

To stop one or more running Docker containers, you can use the docker stop command. The syntax is simple: $ docker stop [OPTIONS] CONTAINER [CONTAINER...] You can specify one or more containers to stop.

Does Docker compose start container?

The docker compose up command aggregates the output of each container (like docker compose logs --follow does). When the command exits, all containers are stopped. Running docker compose up --detach starts the containers in the background and leaves them running.

Why you shouldn't use Docker compose in production?

It's a cool tool to make handling container configuration or multiple interconnected containers a bit easier. The “don't use docker-compose in production” statement is motivated by hidden assumptions which are not necessarily valid for everybody, and propagated by unclear communication.

How do you stop all the containers created by Docker compose?

Kill All Containers Using Docker Compose If you do, killing multiple containers takes one command: docker-compose down. You could also run docker-compose without detached mode.


2 Answers

Use the following to exclude specific services:

docker-compose up --scale <service name>=0
like image 142
adaml Avatar answered Sep 28 '22 17:09

adaml


Think you have to go the "other way". You can start single containers from your docker-compose.yml via:

docker-compose up -d --no-deps ServiceName
like image 45
opHASnoNAME Avatar answered Sep 28 '22 19:09

opHASnoNAME