I have a number of containers on Docker in the AWS EC2 instance. All the containers are set to restart=always using this command
sudo docker update --restart=always 0576df221c0b
But, After the AWS Linux host start, docker containers on AWS now do not start until I run the “docker ps” command in the terminal. Here is a screenshot of docker ps. the screenshot below was taken after 1 hour of the AWS Linux reboot.
Any ideas about what might be causing the problem? Thanks a lot
Check the status of docker service & docker systemd socket. Probably docker service is down. And systemd socket is enabled for docker.
systemctl status docker.service
systemctl status docker.socket
When socket is enabled, Systemd daemon open listening sockets on behalf of the docker application and only start the docker daemon when a connection comes in. In your case when you execute the docker ps, a connection reaches to the listening socket and it in turn starting the docker.
To change the behaviour, enable the docker service. Then all your containers should start on system boot up. Run the following command
systemctl enable docker.service
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