DEV Community

chair
chair

Posted on

9 3

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.

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay