Command for restarting all running docker containers?

Ranjith's picture Ranjith's · Jul 6, 2016 · Viewed 109.2k times · Source

How to restart all running docker containers? Mainly looking for a shortcut instead of doing

docker restart containerid1 containerid2

Answer

Andrey Romashin picture Andrey Romashin · Jul 6, 2016

Just run

docker restart $(docker ps -q)

Update

For Docker 1.13.1 use docker restart $(docker ps -a -q) as in answer lower.