How to restart all running docker containers? Mainly looking for a shortcut instead of doing
docker restart containerid1 containerid2
For restarting ALL (stopped and running) containers use docker restart $(docker ps -a -q) as in answer lower.
If you mean to create multiple containers at the same time then you will have to make use of docker-compose. This will startup any stopped containers.
The Docker Engine must reload configuration information if any changes are made to the Docker configuration. To do this, you must restart the docker service. If you edit the /etc/sysconfig/docker configuration file while the docker service is running, you must restart the service to make the changes take effect.
As a reference, I use 30 1 * * * docker restart container_name to restart a container every day at 01:30 at night. You can get the container_name by running docker ps .
Just run
docker restart $(docker ps -q)
Update
For restarting ALL (stopped and running) containers use docker restart $(docker ps -a -q)
as in answer lower.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With