# Stopping and restarting the Docker Compose image

**URL:** <https://openziti.discourse.group/t/stopping-and-restarting-the-docker-compose-image/594>\
**Category:** Building/Development\
**Created:** [June 20, 2022, 2:01am UTC](https://openziti.discourse.group/t/stopping-and-restarting-the-docker-compose-image/594 "2022-06-20T02:01:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [June 20, 2022, 2:01am UTC](https://openziti.discourse.group/t/stopping-and-restarting-the-docker-compose-image/594/1 "2022-06-20T02:01:10Z")

</div>

This is probably a beginner's question.. but.. that's me.

I worked through starting up the container.. and all good.. but then I needed to stop it... which also worked.

However, when I wanted to restart the docker container again, I needed to kill all of the docker processes that were still running.

I don't really know much about this.. and thought to ask for any tips on how to restart it..without needing to kill all of the processes

> is this even possible?

---

<div class="post-metadata">

**Author:** ![gooseleggs](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/gooseleggs/32/450_2.png) [@gooseleggs](https://openziti.discourse.group/u/gooseleggs)\
**Post date:** [June 20, 2022, 6:16am UTC](https://openziti.discourse.group/t/stopping-and-restarting-the-docker-compose-image/594/2 "2022-06-20T06:16:05Z")

</div>

To stop the containers

docker-compose down

To stop the containers within the directory with the docker-compose.yml file.

Then start it up again (docker-compose up -d). That is what I do.

Note that it appears in later versions of docker that docker-compose is now a plug-in, so remove the hyphen between the commands above

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [June 20, 2022, 7:59pm UTC](https://openziti.discourse.group/t/stopping-and-restarting-the-docker-compose-image/594/3 "2022-06-20T19:59:54Z")

</div>

Like @gooseleggs said, to start docker as a daemon, you can pass the `-d` flag. Then to stop docker you need to use `docker-compose down`

If you run it interactively, as I often do in my videos, a simple “ctrl-c” in that window will also stop the containers. To remove the whole docker environment and start CLEAN (don’t do this unless you know you want to start **clean** ) issue:

```auto
docker-compose down -v

```

This destroys your PKI, so don’t do that unless you want to **really** start clean ! 🙂

There are mountains and mountains of pages on the internet around docker/docker-compose. Their online help is usually a really good reference [Get started with Docker Compose | Docker Documentation](https://docs.docker.com/compose/gettingstarted/)

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [June 20, 2022, 11:36pm UTC](https://openziti.discourse.group/t/stopping-and-restarting-the-docker-compose-image/594/4 "2022-06-20T23:36:52Z")

</div>

Awesome… thanks so much… its really the first time I use Docker.

My next plan is Kubernetes… but I will leave that for another day 🙂

---

<div class="post-metadata">

**Author:** ![gberl002](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/gberl002/32/333_2.png) [@gberl002](https://openziti.discourse.group/u/gberl002)\
**Post date:** [June 21, 2022, 7:17pm UTC](https://openziti.discourse.group/t/stopping-and-restarting-the-docker-compose-image/594/5 "2022-06-21T19:17:14Z")

</div>

One more thing you might want to be aware of is the `prune` option. If you do happen to `docker-compose down` without `-v` or you stop the containers manually and you decide you want to `docker-compose up` with a fresh instance (or if you’re just seeing some weird behavior and want to be sure you have a clean environment). I would recommend checking out these two commands:

`docker network prune` - Removes any networks not currently being used  
`docker volume prune` - Removes any volumes not currently being used

Alternatively you can `docker network ls` or `docker volume ls` to list each network/volume if you want to manually delete them (in case you have other volumes or networks you want to keep).

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [June 22, 2022, 12:57am UTC](https://openziti.discourse.group/t/stopping-and-restarting-the-docker-compose-image/594/6 "2022-06-22T00:57:43Z")

</div>

Awesome… thanks for sharing the extra commands… this is very helpful
