Stop docker-compose

 
DevTools CLI Documentation

You may want to recoup the resources used by your projects containers and the docker host for other things if you are done with development for a while. You can stop the containers for a single project only or all containers and the docker host depending on what you are finished using.

  1. If you only want to stop the containers for your project, in the project directory, run docker-compose stop or press Ctrl-C to stop a docker-compose process running in the foreground and then run docker-compose stop to ensure the project containers have stopped.

  2. If you want to shut down the docker host as well as any containers, run devtools stop

Cleaning Up

From time to time you'll want to clean up stopped containers. You'll also want to take special care when finishing a project to release all the resources used by it.

For periodic cleanup of all stopped containers, run the following script while your docker host is running: devtools prune

If you only want to clean up project specific stopped containers, you can run: docker-compose rm from your project directory.

When you are finished with a project, if you used any persistent data storage you'll want to run a command to clean it up. The exact directory to request removal from will depend on your project [see suggested directory naming guidelines in Common Setup]: docker ssh dev sudo rm -rf /data/[project]/

Built with MkDocs using a theme provided by Read the Docs.

BitBucket « Previous Next »

The docker-compose stop command will stop your containers, but it won’t remove them.

The docker-compose down command will stop your containers, but it also removes the stopped containers as well as any networks that were created.

You can take down 1 step further and add the -v flag to remove all volumes too. This is great for doing a full blown reset on your environment by running docker-compose down -v.

There’s other neat things you could with the down command. Run the docker-compose down --help command to learn more about them.

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.

Comments

© 2022 Nick Janetakis

Follow @nickjanetakis

Force stop service containers.

Usage

$ docker compose kill [options] [SERVICE...]

Extended description

Forces running containers to stop by sending a SIGKILL signal. Optionally the signal can be passed, for example:

$ docker-compose kill -s SIGINT

Options

Name, shorthand Default Description
--signal , -s SIGKILL SIGNAL to send to the container.

Parent command

Command Description
docker compose Docker Compose

Usage: docker-compose kill [options] [SERVICE...] Options: -s SIGNAL SIGNAL to send to the container. Default signal is SIGKILL.

Forces running containers to stop by sending a SIGKILL signal. Optionally the signal can be passed, for example:

docker-compose kill -s SIGINT

fig, composition, compose, docker, orchestration, cli, kill

Stop services

Usage

$ docker compose stop [SERVICE...]

Extended description

Stops running containers without removing them. They can be started again with docker compose start.

Options

Name, shorthand Default Description
--timeout , -t 10 Specify a shutdown timeout in seconds

Parent command

Command Description
docker compose Docker Compose

Usage: docker-compose stop [options] [SERVICE...] Options: -t, --timeout TIMEOUT Specify a shutdown timeout in seconds. [default: 10]

Stops running containers without removing them. They can be started again with docker-compose start.

fig, composition, compose, docker, orchestration, cli, stop

Video liên quan

Chủ Đề