A
A
AlexChAR2021-10-24 11:34:20
Docker
AlexChAR, 2021-10-24 11:34:20

Docker container with its own ip (received via dhcp) in the external network. Ahh... how?

I want to deploy a container with gitlab. It uses ports 22, 80 and 443 during operation. Ports 80 and 443 can be forwarded by nginx when accessing the domain name. But what to do with port 22? Do not take it from the main host .. Doing forwarding with reassignment like -p 2022:22 is also not an option. Clients will then have to manually specify the port each time ..

Is it possible to pull the container into the external network and so that it receives ip from the same dhcp as the main machine?
(And so that the butter on the roll itself is smeared please ...)
Example:
192.168.1.1 - dhcp server / gateway
192.168.1.22 - the main host on which the containers are spinning
192.168.1.33 - the container with gitlab

I tried to read it myself, but in understanding overseas dialect is very limited ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-10-24
@AlexChAR

Add one more (or more than one) IP to the interface on the host machine and assign a port to it.

ports:
    - "192.168.0.22:22:22"

But you can mess with Experimental Docker Libnetwork DHCP Driver

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question