Why Docker container with –link and restart policy isn't started?

I have two containers, the first one is redis and the second one is my app which has –link to redis container. They both have 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 redis container is started. BTW, if there isn’t –link in the app container it’s started as well.

  • How to push a docker image to a private repository
  • nginx+php-fpm docker-compose not work
  • How do I debug “No default robot”?
  • running nodejs app in docker with redirecting standard output to a file
  • How to deploy Spring Boot application to Google Managed VM
  • build a data container or point to the existing files in docker?
  • My Docker version 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
    

  • Unable to build docker image with error “shim error: docker-runc not installed on system”
  • Docker container, how to use host proxy
  • change docker instance run arguments
  • How to set docker-machine env for fabric local() commands
  • Unable to build docker image, “must be a root user”
  • Does the process inside of the docker image still need to be managed?
  • One Solution collect form web for “Why Docker container with –link and restart policy isn't started?”

    Did you already try to use --restart:always instead?

    I assume that your app container is not restarted because it ended successfully during docker stop. redis might be restarted due to an error (did you have a look at docker logs for the rediscontainer?). So when you specify --restart:on-failure:10 in that situation it would work as designed because only rediswas failing.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.