Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error response from daemon: rpc error: code = InvalidArgument desc = only updates to Labels are allowed

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
like image 565
Ryabchenko Alexander Avatar asked Sep 21 '19 04:09

Ryabchenko Alexander


2 Answers

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.

like image 116
Mohsenasm Avatar answered Sep 20 '22 01:09

Mohsenasm


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.

like image 24
Erfun Avatar answered Sep 20 '22 01:09

Erfun