1

I've successfully setup a Docker Swarm cluster consisting of one master and two nodes.

Everything works as expected, only one thing deviates from the documentation. According to the docs (look for "Run a container on the Swarm") I should see the output from the command when I run something on the Swarm, but that's not what happens to me:

$ docker run hello-world   # <<< no output

$ docker ps -a
CONTAINER ID        IMAGE                COMMAND                CREATED             STATUS                     PORTS               NAMES
663f36f72ee1        hello-world:latest   "/hello"               4 seconds ago       Exited (0) 3 seconds ago                       node-1/serene_pare
...

$ docker logs 663f36f72ee1 # <<< however everything looks good
Hello from Docker.
This message shows that your installation appears to be working correctly.
...

What am I doing wrong?

UPDATE: Using run -i solves the problem. Still, I'm curious why -i is necessary with Swarm only, and why the documentation doesn't say so.

030
  • 5,901
  • 13
  • 68
  • 110
Likk
  • 111
  • 4

1 Answers1

1

The documentation is wrong and this issue fixes the documentation.

The reason why the -i --interactive flag is needed is because the -i flag allows us to make an interactive connection by grabbing the standard in (STDIN) of the container since the container is on another host.

kamger
  • 159
  • 2
  • The issue has been closed saying that it happens only with vagrant. Obviously I'm not using vagrant – Likk Mar 31 '16 at 08:43
  • you are correct. I experienced the issue reproducing it using vagrant and posted this comment however then closed it when I noticed it working the way it was supposed to using docker-machine (as the docs suggest) – kamger Mar 31 '16 at 15:23