background:
We are using registry_mirrors
& insecure_registries
options in docker
daemon.json
file. We would like to stop setting the location of the mirrors
hard-coded.
Question
Is it possible to use env variable
inside daemon.json
? So instead of writing ip
X.Y.Z.W:PORT
one would write ${REPO1}
. Hopefully it will be possible to change REPO1
var without restarting the daemon
Remarks
The solution must allow to change the repo
location without restarting the daemon
EDIT
it is not possible to use the following inside daemon.json 1. ${VAR_NAME}
Possible workaround
Use custom hostname and redefine it in /etc/hosts
. This allows to change repo ip
without restarting the daemon. But it does not allow to change the port
or the protocol
Possible workaround 2
Some options can be reconfigured when the daemon is running without requiring to restart the process. We use the SIGHUP signal in Linux to reload, and a global event in Windows with the key Global\docker-daemon-config-$PID. The options can be modified in the configuration file but still will check for conflicts with the provided flags. The daemon fails to reconfigure itself if there are conflicts, but it won’t stop executionsource
So one can edit the registry
and do sudo systemctl reload docker
or sudo kill -SIGHUP $(pidof dockerd)
. This does not restart the existing containers nor the daemon itself