xpt
xpt

Reputation: 23054

Start a stopped Docker Compose container

Is it possible just to start a single container among a group of stopped Docker Compose container?

I have a docker-compose.yml file that contains 4 containers: redis, postgres, api and worker. If all of them has stopped, can I start just one of them to check the config files within it? I'm getting

you cannot start and attach multiple containers at once

and I'm wondering if there is any way to work around it.

Upvotes: 0

Views: 93

Answers (1)

Muhammad Rio
Muhammad Rio

Reputation: 939

You can run a single container with command

docker compose start <service-name>

Note: it won't work if your service/container are depends on another service/container.

If you want to check the config files within it, you could just run

docker compose run -it <service-name> sh

Note: it will create and running a new container.

Another way to do it is by copying the config file directly without running the stopped container with this command

docker compose cp <service-name>:<config-file-path> <destination>

Upvotes: 0

Related Questions