Docker Community Forums

Share and learn in the Docker community.

Rolling Update With Same Tag

My docker image doesn’t ever change, only the artifact that the image pulls from nexus changes. When I specify:

docker service update service-name

nothing happens, but if I change the image tag like so:

docker service update --image new-image service-name

things magically update. I’m guessing the fact that the image doesn’t change it’s not performing a rolling update. Is there anyway to force the update to happen even if nothing on the service itself has been modified? Because indeed in my case something has changed, but it is obscured from docker itself. This seems like an obvious use case during development phases where you always want to use the :latest tag.

Hello Matt,

I’m facing the same issue here.
I want to update using the :latest tag and I can’t do it each time, because it won’t pull the new image since it’s the service is running with the same tag.

However I’ve noticed I can do the following thing:

docker service create service-name
and update (but only once because it’s not the same tag) with
docker service update service-name:latest

Is there any way of updating the service with the latest tag multiple times (taking into account that the image on the docker registry was updated) ?

Hi portepa,

I have found a work-around for this issue, and should have posted it as soon as I found it, sorry about that. In my case I am using Jenkins to perform a Continuous Delivery rolling update by issuing the command:

docker service update service-name

But like we discussed this doesn’t pick up any changes and just aborts the rolling update. So what I did to get around this was add a dynamic environment variable to the rolling update. I didn’t want the environment variable to be completely useless so I used something that might provide useful in the future which was Jenkins Build information. So the final command looks something like:

(based on your rc version it may be --env or --env-add)

docker service update --env "JENKINS_META=$JOB_NAME[$BUILD_NUMBER]" service_name

if you aren’t using jenkins you can do something similar with just the date like so:

docker service update --env "UPDATE_DATE=$(date)" service_name

Hope this helps!

And just to finalize this, it would be nice if there was something baked into docker for this. Something like:

docker service update --force service-name

This wouldn’t check for changes and just perform a rolling-update against all existing replicas.

Thanks Matt!
This definitely helps.
I used the same workaround but for the docker build. It resolved in a new version tag at each new commit on master branch. I did not like to make a new tag for each commit. That was a bit messy.

I’ll implement your solution I think.
Thanks again !

Hey!

cool. At the moment I always switch between

docker service update --image $IMAGENAME:latest
and
docker service update --image $IMAGENAME
to achieve an image update. I think docker should check the image hash and preform an update if the :latest Image is newer than the running once.

I`ll try the environment “trick”

EDIT:
the command is --env-add in docker 1.12.3 for the docker service update