Docker restart policies permit to have my containers restarted if container or host crashes… As some containers share the same network and subnet, the IP address of a specific container can change on restart.
This is a problem as routing to this specific container is wired on the host (nginx config with custom scripts).
Using static ip addresses is not a good idea for me as I scale / duplicate some containers in order to have continuous deployment of new app versions.
Is there a way to have dockerd run a specific script at start ? (in case my host reboots)
Is there a way to have dockerd run a specific script after (re)start of a specific container ? (in case the container crashes)
More generally, what would be the best practice to force a host script to be run each time a container is restarted by dockerd ?