S
S
Stepan Rodionov2019-03-06 13:21:24
Docker
Stepan Rodionov, 2019-03-06 13:21:24

How to forward a port to the docker network without occupying it on the host machine?

There is the following picture: a large number of projects in development, for each a set of containers is created, which is launched via docker-compose. Ports are forwarded to the machine, the developer opens the site in the browser on his computer and works with it.
The problem is that it does not scale well: it is difficult to launch 2-3 projects at once, but there is a need for this from time to time. At the same time, a network is created in docker-compose for containers, it has some kind of ip (for example, 172.23.0.1) on which it all also responds.
Question: is it possible to open ports only to the network without occupying them on the host machine and how to do this? It is assumed that the network address is unknown before the creation of ip, so the construction of the form "172.23.0.1:80:80" cannot be used.
In general, it's cool if there is some kind of hostupdater plugin that will create an entry in hosts like projectname.dev -> network ip

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question