I try to add a command to the app.yml file to add an entry to the host file in the docker container at the rebuild.
But this command never works and i can’t understand why
The issue seems to be, that command will work just fine, but will be lost on container start. Go ahead and enter the container, run the command by hand, then restart it:
But you’d need to do that every start. (And if you try to modify launcher to do that for you, launcher will get upset when it can’t update itself with git. Ask me how I know this? I’ve done that.)
Okay, I figured it out. You cannot use the yml file because /etc/hosts is created at runtime by Docker itself. To add entries to it, you need to use the --docker-args option to launcher at rebuild time.
./launcher rebuild app --docker-args "--add-host extra.dns:8.8.8.8"
./launcher enter app
grep extra /etc/hosts
8.8.8.8 extra.dns
There are a slew of dns / resolver / similar options for docker run, and those are the ones you need to use for this sort of stuff.
Changes to /etc/hosts file are effectively immediate for the system. Docker creates the file at boot time, while setting up all of the container internal networking. But after that Docker leaves it alone. A “plug-in” that inserted itself into late system boot could add values to the /etc/hosts file. (Or could be a script created via yml.)
Yep, updating docker_manager just updates the docker_manager discourse plugin, which contains all the scripts for updates. It still doesn’t even restart the container, let alone rebuild it.