The operation of Docker Network

1

I've always wanted to have a server so that I could learn about DevOps and so on. Here's an old computer here with reasonable settings: i5, 8GB RAM and 500Gb HDD. I started to study about Docker and wondered if I would always have to bind the actual ports to the instances, but I see in the docker network documentation that we should pass the ip of the network and then connect the < in> conteiners to it. Here are some references:

After reading these articles, I had some questions.

How is the computer interpreted by the containers?

When I create this docker network, does the server become a router for the containers?

And the features of the machine?

The docker already needs at least 2 GB of ram and etc. to be installed, with the creation of a docker network, how does the memory consumption?

As in real life, is it possible to connect two networks?

Let's say I have the following scenario:

DoIneedtoconfiguresomethingonmynetworksothatMyNotebookcanaccessthex.27.1andx.28.1databaseorthex.28.2ssh?

WhenIconnectwithx.25.129IdonotneedtoputtheIPofit,justthenameie:

~$sshsa@gipsydanger

Yes,InamemymachineswithJaegersnames.

Sotoconnecttotheseotherinstanceslocatedatx.27.xandx.28.xwouldIneedtouseyourIP?

[email protected]

IfyoucantellmemorethingsIcandotolearnmore,Iwouldappreciateit.

Extra

IfIhappentowanttocreatea NameServer by using the Ubuntu BIND for the entire local network at 192.168.xx would I have to change some configuration on my router? Would that hurt my internet performance?

I already thank you and if this question is inappropriate for the community please let me know, I'm learning about the OS yet.

    
asked by anonymous 18.07.2017 / 20:03

1 answer

1

The network in docker is not so complex. It is a subnet inside your server. With bind you do a specific port, this is useful for your machines outside the internal docker network. However, for communication between containers, no port exposure is required. Containers on the same docker network, talk to each other by their own name, but you can also define aliases for these containers. All container ports are free on the docker network and only to expose to outside that network you need to bind.

Assuming you want to expose a port from a container to the internet, this is a good example, you should:

  • Configure port forward on your router pointing to the host that owns the container.
  • Create the container with bind to the same mapped port.

Ready ... with this from the internet you can access your container. If you want to access via SSH.

A container can also take over the host network using the network host configuration. So no door openings are required, but it's not legal practice, especially if you're thinking about scaling.

If you are using swarm docker, another interesting fact is that any node is a proxy for the correct container. All nodes are proxies to any node in the swarm network, this is very interesting.

    
20.07.2017 / 03:12