Avoid need to rebuild web container after reboot?


(Jason Ives) #1

I don’t need to reboot my host or restart docker very often but it has come up a couple times recently.

The problem is that when docker restarts containers are not being assigned the IPs they previously used – a data container might have been 172.17.0.2 before but is 172.17.0.9 after a reboot. Because of this the web container is unable to connect to a database and I am forced to find my data container’s IP, reconfigure and rebuild the web container.

I’d love to avoid this.

Thinking that I could at least avoid the need to look up and reconfigure the ip (skipping straight to launcher rebuild) I have tried linking the containers but I am unable to bootstrap when doing so - it fails when trying to connect to the database, unable to resolve the host; I am using ‘data’ for the link alias and ‘data’ for DISCOURSE_DB_HOST/DISCOURSE_REDIS_HOST.

What can I do to make life easier? I’d like to at least have the link work. Better still I’d love to have static IPs for my containers so that regardless of what order things were automatically started in everything would be connected once all containers started.


(Jeff Atwood) #2

Any ideas on this @sam?


(Sam Saffron) #3

Export the port to the host, shut it down to the world using iptables and it will remain stable.

That is what we do for all our stuff.


(Kane York) #4

I just submitted a patch to allow for the use of a DISCOURSE_REDIS_SOCKET, so that will be another solution - exposing the sockets to the web container.