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.
Документация неверна, и эта проблема исправляет документацию.
Флаг -i --interactive необходим потому, что флаг -i позволяет нам для создания интерактивного соединения путем захвата стандарта в (STDIN) контейнера, поскольку контейнер находится на другом хосте.