Why is the Docker container with the -link and restart policy not running?

I have two containers, the first is redis and the second is my application that has a -link for the redis container. They both restart policies :

docker run --restart=on-failure:10 --name redis redis docker run --restart=on-failure:10 --name app --link redis app 

Then when I sudo service docker stop and then sudo service docker start only the redis container starts. BTW, if there is no link in the application container, it also starts.

My version of Docker is 1.7.1.

 vagrant@vagrant-ubuntu-trusty-64 :~$ docker version Client version: 1.7.1 Client API version: 1.19 Go version (client): go1.4.2 Git commit (client): 786b29d OS/Arch (client): linux/amd64 Server version: 1.7.1 Server API version: 1.19 Go version (server): go1.4.2 Git commit (server): 786b29d OS/Arch (server): linux/amd64 
+5
source share
1 answer

Have you tried using --restart:always instead?

I assume that your app container does not restart, as it completed successfully during docker stop . redis might be restarted due to an error (have you seen docker logs for the redis container?). Therefore, when you specify --restart:on-failure:10 in this situation, it will work as it was designed, because only redis failed.

+1
source

All Articles