I don't seem to be "swarming"

I’m new to Docker as well as to Docker for AWS, so please forgive me if I’ve missed something obvious and so this is a stupid set of questions…

When I SSH into my swarm using the SSH address in “Outputs”, I am attached randomly to one of my manager nodes. I get that…ELB is round-robin directing the SSH connection.

But once I’m logged onto a manager, it appears that docker containers that I start using “docker run” actually run on the manager I’m SSH’d into. If I start a container, exit my SSH session, and SSH again, I log into a different manager. Then “docker ps” doesn’t show the container I launched in the prior SSH session…apparently because its really running on the first manager I SSHd into and now I’m on a different manager.

So where is the “swarm” behavior? Shouldn’t my container be running on one of the worker nodes, and shouldn’t the managers show a common view of my swarm? Is there a different tool than “docker” I’m supposed to run to get swarm behavior?

TIA for any enlightenment.

Thanks for starting this thread!

To take advantage of swarm-mode, use docker service create instead of docker run. To deploy more complex apps, use DAB files: https://blog.docker.com/2016/06/docker-app-bundle/

Let us know if that doesn’t answer your question.

Thanks for the quick response!

So it seems that newbie me has to learn about Docker swarms in general. I’ll do that. Doesn’t this mean that your “Deploying your app” documentation page is kinda, with all due respect, misleading and wrong? Isn’t using “run” here inappropriate? Just trying to get a clear grasp on things.

What documentation are you referring to? This uses service create: https://beta.docker.com/docs/deploy/#running-apps

I’m referring to the first sample container execution, “docker run hello-world”. This seems to suggest that both ways of starting containers are appropriate for Docker for AWS. Again, I’m a newbie, so maybe it’s obvious to more seasoned Docker folks as to what’s going on here. I guess you’re offering up standard Docker Swarm behavior, and I should understand all the nuances of that.

Looking at the Docker Swarm docs, it appears that there should be a Docker Swarm API port that will let me point an agent at that port and then be able to use the swarm much like I use a single Docker instance, like use “run”, “logs”, etc. Is such a port available on Docker for AWS? Am I reading that wrong.

I ask the above in part because I can’t get the ‘service’ command to run a container that I am able to run with ‘run’, and I can’t tell why. “docker service ls” always shows REPLICAS = 0/1 and nothing is listening on the ports I’ve mapped to.

Is this an image in a private repo? You’ll have to pass --with-registry-auth for that to work. We’re adding that to the docs in the next push.