Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker containers on AWS now do not start until I run the “docker ps" in terminal

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.

enter image description here Any ideas about what might be causing the problem? Thanks a lot

like image 329
JAMSHAID Avatar asked Oct 31 '25 17:10

JAMSHAID


1 Answers

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
like image 157
Jyothish Avatar answered Nov 02 '25 12:11

Jyothish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!