The operation of Docker Network

Asked

Viewed 873 times

1

I always wanted to have a server so I could learn about Devops and so on.. Here comes an old computer here with reasonable settings: i5, 8GB RAM and 500Gb HDD. I started studying about Docker and I wondered if I would ever have to make one bind from the actual ports to the instances, but I see in the documentation 'Docker network' that we should pass the network ip and then connect the containers to her. Below are some references:

After reading these articles, I had some doubts.

How the computer is interpreted by containers?

When I create this Docker network, the server becomes a router for the containers?

And the machine’s resources?

Docker already needs at least 2 GB of ram etc to be installed, with the creation of a Docker network, as is the memory consumption?

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

Let’s say I have the following scenario: Imagem Ilustrativa

I need to set something up on my network so that My Notebook can access the x.27.1 and x.28.1 database or the x.28.2 ssh?

When I will connect with x.25.129 I do not need to put his IP, just the name ie:

~$ ssh sa@gipsydanger

Yes, I name my machines after Jaegers.

So to connect with these other instances located in x.27.x and x.28.x I would need to use your IP?

~$ ssh [email protected]

If you can give me more information I can do to learn more I’d appreciate it.

Extra

If I ever wanted to create a Nameserver using the BIND by Ubuntu for the entire local network at 192.168.x. x would have to change some configuration on my router? This would harm my internet performance?

Thanks in advance and if by chance this question is inappropriate for the community please let me know, I’m learning about the OS yet.

1 answer

1


The network on Docker is not so complex. It is a subnet within your server. With the bind you set up a specific port, this is useful for your machines outside of the Docker’s internal network. However, for communication between containers, no port exposure is required. Containers on the same Docker network, speak to each other by their own name, but you can also set alias for these containers. All container ports are free on the Docker network and just to expose out of that network you need to bind.

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

  • Configure the forward port on your router by pointing to the Host that has the container.
  • Create the container with bind for 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 there is no need for door openings, but it is not a legal practice, especially if you are thinking of scale.

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.