0

I'd like to kill/stop/down the whole compose project without having to kill or type each individual containers.

I get the the project's name using docker compose ls.

$ docker compose ls
NAME                STATUS              CONFIG FILES
docker              running(2)          /home/docker/docker-compose.yml,/home/docker/docker-compose.without-nginx.yml
documents           running(1)          /home/docker-composer-jellyfin.yml

docker compose kill docker doesn't work. "no such service: docker"

2
  • Just docker compose down? Commented Mar 20 at 4:13
  • and how to select which project? that is good if I am in the folder with the .yaml Commented Mar 20 at 4:47

2 Answers 2

4

If you want to specify the project name explicitly (which is useful if you have multiple projects), you can use the -p or --project-name option.

Refer this:- https://docs.docker.com/reference/cli/docker/compose/#use--p-to-specify-a-project-name

  • Stop the docker project:
docker compose -p docker stop
  • Down the docker project:
docker compose -p docker down
Sign up to request clarification or add additional context in comments.

Comments

0

The following commands will stop or kill all containers in a Docker Compose project:

  1. Graceful shutdown (stops and removes containers, networks, and optionally volumes):

    docker compose -p docker down

  2. Force stop all containers (immediate termination):

    docker compose -p docker kill

  3. Alternative approach (stop first, then remove containers):

    docker compose -p docker stop docker compose -p docker rm -f

Replace docker with your actual project name if different.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.