Docker Containers and Static IPs?

Hi there,

I am trying to see if I can replace my VM setup and have docker containers instead.

Currently I have an Ubuntu headless server with virtualbox on it and several VMs:

  • pihole
  • craft cms1
  • craft cms 2
  • ubuntu headless server 1
  • ubuntu headless server 2

For each of these VMs I have assigned a static IP number on my router based on the virtual mac address.

I am unsure how to do this the “docker way”. I understand that for things like websites, I can access them through the IP:port-number combination of the docker host.

But for example my pihole VM is acting as a DNS server, so for example on my Windows 11 laptop I have entered the IP number of the pihole VM. As far as I can tell, Windows 11 and probably many other devices, do not accept a custom port for DNS servers (at least it ignored any port number I added during my test).

So the question is, can I assign a static IP to a docker container and is this IP managed on my router through DHCP? Is there something like a “virtual mac address” for a docker container?

Sure is :slight_smile:

Very nice, thanks! [20characters]