I, through docker-compose, pick up a few containers from this turnip and wrap my code. Containers and site work.

The question arose that the containers be assigned an address on the network (IP) and that any computer on the network could go to that address.

On this issue, I found more or less reputable answers here , but they imply a direct indication of which IP should be issued (after the issue, the site becomes accessible via this IP).

Now I am working on optimization and the question was: How can I get any free IP from DHCP, and how can I use it at startup?

  • When starting, do you want to assign the address obtained by dhcp to the container? - Mikhail Vaysman
  • Docker-containers (without additional network plug-ins) cannot work otherwise than using a host network or an internal private network. In order to issue an IP address on the interface, it must first be created on the host machine, and this does not fit well with the general concepts of the docker (which means that all things are happening in isolation from the host). Use the fronten proxy, which will hang in the same internal networks and receive the final address via dns. - etki

0