Docker swarm-manager displays old container information

I am using docker-machine with Google Compute Engine(GCE)
to run a
docker swarm cluster. I created a swarm successfully with 2
nodes
(swnd-01 & swnd-02) in the cluster. I created a daemon container
like this
in the swarm-manager environment:
docker run -d ubuntu /bin/bash

docker ps shows the container running on swnd-01. When I tried
executing a command over the container using docker exec I get the
error that container is not running while docker ps shows otherwise.
I ssh‘ed into swnd-01 via docker-machine to come to know that container
exited as soon as it was created. I tried docker run command inside the
swnd-01 but it still exits. I don’t understand the behavior.

  • Why does running docker with ProcessBuilder cause a hang?
  • Use docker-compose env variable in Dockerbuild file
  • Are docker artifacts when running a container stored in host fs or memory?
  • How to dockerize Ruby on Rails for production?
  • docker run --ulimit cpu=10 does not kill java process after timeout
  • How to start docker container as server
  • Any suggestions will be thankfully received.

  • dockerfile: not able to run command
  • How to execute bash script in docker container before docker will run CMD?
  • spring-boot cannot start in docker
  • how to access environment variables in Windows Docker healthcheck script
  • Why does the tag appear to be tightly coupled to hostname of the registry?
  • Using docker on Mac. Is it possible to start docker daemon using docker-machine and pass in arguments?
  • One Solution collect form web for “Docker swarm-manager displays old container information”

    The reason it exits is that the /bin/bash command completes and a Docker container only runs as long as its main process (if you run such a container with the -it flags the process will keep running while the terminal is attached).

    As to why the swarm manager thought the container was still running, I’m not sure. I guess there is a short delay while Swarm updates the status of everything.

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