moby: Renaming service doesn't rename service tasks / containers
Renaming a service doesn’t rename/update the services’s containers/tasks:
$ docker service create --name web nginx:alpine
9qmzbansw53tteaocl2uhgf3v
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e4e8461a30d2 nginx:alpine "nginx -g 'daemon off" 1 seconds ago Up Less than a second 80/tcp, 443/tcp web.1.2onlllux6w6haprqyjpzyx2fz
$ docker service update --name frontend web
web
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e4e8461a30d2 nginx:alpine "nginx -g 'daemon off" 2 minutes ago Up 2 minutes 80/tcp, 443/tcp web.1.2onlllux6w6haprqyjpzyx2fz
New containers/tasks are named after the new service name:
$ docker service update --replicas=2 frontend
frontend
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dd3d2f10b9ec nginx:alpine "nginx -g 'daemon off" 11 seconds ago Up 10 seconds 80/tcp, 443/tcp frontend.2.38oyjutl1ljis0a3n2psimmfd
e4e8461a30d2 nginx:alpine "nginx -g 'daemon off" 3 minutes ago Up 3 minutes 80/tcp, 443/tcp web.1.2onlllux6w6haprqyjpzyx2fz
It becomes more confusing if you inspect the containers;
$ docker inspect frontend.2.38oyjutl1ljis0a3n2psimmfd
"Labels": {
"com.docker.swarm.node.id": "f0k5s1khmlk9d0fnnbt3fmchx",
"com.docker.swarm.service.id": "9qmzbansw53tteaocl2uhgf3v",
"com.docker.swarm.service.name": "frontend",
"com.docker.swarm.task": "",
"com.docker.swarm.task.id": "38oyjutl1ljis0a3n2psimmfd",
"com.docker.swarm.task.name": "frontend.2"
}
$ docker inspect web.1.2onlllux6w6haprqyjpzyx2fz
"Labels": {
"com.docker.swarm.node.id": "f0k5s1khmlk9d0fnnbt3fmchx",
"com.docker.swarm.service.id": "9qmzbansw53tteaocl2uhgf3v",
"com.docker.swarm.service.name": "web",
"com.docker.swarm.task": "",
"com.docker.swarm.task.id": "2onlllux6w6haprqyjpzyx2fz",
"com.docker.swarm.task.name": "web.1"
}
Or create a new web
service now
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 21 (20 by maintainers)
@stevvooe @icecrime I opened a PR for discussion https://github.com/docker/docker/pull/26988
@icecrime @thaJeztah @mrjana At what point did we decide to support service rename? I recall specifically preventing this due to the complexity of it.