DEV Community

chair
chair

Posted on

Restart all running docker containers

Save yourself the hassle of restarting your containers individually.

First see which containers are currently running:
docker ps

To restart an individual container you can run:
docker restart <container id>

It can be useful to feed the output of a docker command into another to save the effort and time of running the above, if you know you want to restart all the containers.

Restart all running containers:
docker restart $(docker ps -q)

Happy dockering!

Top comments (3)

Collapse
 
oshikore profile image
Gabor K. Horvath

docker ps -q | xargs docker restart

is a nice alternative, if you have a lot of containers.

Collapse
 
chair profile image
chair

nice!

Collapse
 
kruben84ec profile image
Christian Ruben Miranda Zambrano

Thanks,.. post.