I have
Error response from daemon: rpc error: code = InvalidArgument desc = only updates to Labels are allowed
when redeploying stack
docker stack deploy -c docker-compose.yml --with-registry-auth monitoring
Unfortunately, as Ryabchenko Alexander said, docker configs cannot be updated, see moby issue.
In one approach you can remove the services that use the new configs, with the command docker service rm service_name
.
Then remove the config with docker config rm config_name
and redeploy the stack to update the config and recreate the removed services.
Update: see this comment if it is necessary to have no downtime.
The suggested removing stack/service approach brings DOWNTIME.
Fortunately, there is a tricky workaround for this issue without downtime. Simply set a name for your config/secret and change that name with help of environment variables every time you run the docker stack deploy
command:
version: '3.7'
services:
nginx:
image: nginx:alpine
configs:
- source: nginxconf
target: /etc/nginx/foobar.conf
configs:
nginxconf:
name: nginx.conf-${CONFIG_VERSION:-0}
file: ./nginx.conf
For the next deployments, change that variable first and then, run docker stack deploy
:
CONFIG_VERSION=1 docker stack deploy -c docker-compose.yml mystack
You can read more here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With