Static IP for Docker container?

I’ve been trying to figure this out for a while and I just can’t seem to find a fix or example on google or in here. At least nothing that makes any sense to me.
I have installed Debian on my old Macbook. I installed Docker and hass.io and what I have configured so far is working very well.
My next step will be to set up DuckDNS but before I do that I need the hass.io container to have a static IP.

For my RPi I simply made the IP static (fixed they call it) on my router and everything works fine. When I do it for the Docker version the IP for HA will still change but I do still see the old IP setup as static on the router.
I’m sure this is a Docker thing and since this is my very first use of it and also being pretty new to Linux, I’m feeling very frustrated.

Can someone please explain to me what I can do to fix this and provide samples?
Feel free to speak to me like I’m a child because honestly that’s how I feel right now.

I installed hass.io according to this site https://github.com/home-assistant/hassio-build/tree/master/install

Thanks!

You don’t give containers IP addresses. You don’t manage those or use the docker IP addresses for anything. You use the host IP address for everything

Ok I can accept that and it would explain why I had so much trouble finding the answer.
I notice right now that I have 2 entries on my router for the laptop. The one its currently connected as shows the correct IP but has a different mac address than the older one from 2 days ago.
I’m not much of a network guy but I thought the mac address was supposed to be consistent?

After some googling I found that I could set the mac within the network manager. It was empty before so I set it to the current value, made the IP static on my network, rebooted and it reconnected to the same IP.
So far so good.
@flamingm0e Thanks for explaining how Docker uses IPs.

1 Like