Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old service containers aren't removed after docker service update "renaming" #24670

Closed
mostolog opened this issue Jul 15, 2016 · 3 comments
Closed

Comments

@mostolog
Copy link

Hi

We are running a service (logstash) which loads the configuration files at startup:

docker service create --mount type=bind,source=/blue/config,target=/etc/logstash/ --name logstash-blue --replicas 10 logstash

The containers are started and visible with docker ps -a
After testing some changes, we would like to have a rolling update without downtime.
To do it, I was trying to do:

docker service update --mount type=bind,source=/green/config,target=/etc/logstash/ --name logstash-green --replicas 10 logstash-blue

If I understood correctly, this should replace each container with the new configuration.
Instead of that, docker ps -a is showing both of them: logstash-blue running and logstash-green stopped, which IMHO shouldn't happen.
Furthermore, I'm not able to remove old service using docker service rm logstash-blue (which makes sense if service is renamed).

Regards

@thaJeztah
Copy link
Member

I think this is a duplicate of #24394, the difference being that this issue isn't about "faulty" containers. Can you try updating the --task-history-limit, as suggested in #24394 (comment) ?

@mostolog
Copy link
Author

mostolog commented Jul 18, 2016

Hi.

I'm sorry.
I didn't notice our containers were failing after ~60s, but as they do and swarm creates new ones, this might be a duplicate of #24394

Nevertheless, after running the "renaming" command, old containers can't be removed using "service rm", because cluster doesn't exists anymore, and "docker rm" must be used.

PS: --task-history-limit didn't seem to solve anything

@thaJeztah
Copy link
Member

The reason you were not able to remove the old service, is that there is no old service; the service was renamed, so it's still the same service, only using a different name.

For example:

docker service create --name oldname nginx
317xys0pztjawph8uffxvodav

docker service update --image nginx:alpine --name newname oldname
oldname

docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES
2aa66c6ff99a        nginx:alpine        "nginx -g 'daemon off"   1 seconds ago       Up Less than a second      80/tcp, 443/tcp     newname.1.9v0iuxa7qcgkemn3dze1q139i
6046e2271c70        nginx:latest        "nginx -g 'daemon off"   25 seconds ago      Exited (0) 1 seconds ago                       oldname.1.4mnae2htd0bfcl0gdpbv151l4

You can remove all tasks/containers by removing the service using the new name:

docker service rm newname
newname

docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants