1

This is a total beginner question with regards to Docker.

I have a basic swarm running on a single host as a testing environment. There are 11 different containers running, all communicating through the host (the literal machine I am now typing this on). Only 1 physical machine, 11 containers.

On my physical machine's localhost I have a MongoDB server running. I want to be able to communicate with this MongoDB server from within the containers in my swarm.

What do I have to configure to get this working? There is lots of information with regards to networking on Docker. I normally use:

docker run --net="host" --rm -ti <name_of_image>

and everything works fine. But as soon as I run a swarm (not a single container) I can't seem to figure out how to connect everything together so I can talk to my MongoDB server.

I realise this is probably a very basic question. I appreciate also that I probably need to read some more of the swarm networking docs to understand this but I don't know which documentation to look at. There seems to be multiple different ways to network my containers and physical machine together.

Any information would be much appreciated, even if it's just a link to some docs you think would be enlightening.

Cheers.

A.Smith
  • 427
  • 5
  • 14
  • all other containers running in swarm? or normal containers? can you update your question with how you are running other container? And if you make all of them to run under one network they will communicate with each other. – Jinna Balu Nov 03 '17 at 16:08
  • All containers are running within the swarm as far as I am aware. – A.Smith Nov 03 '17 at 16:11
  • can you share your .yml file if you have so. else create a .yml with customer network and make it run under the same network. – Jinna Balu Nov 03 '17 at 18:02

0 Answers0