docker-rollout icon indicating copy to clipboard operation
docker-rollout copied to clipboard

Uses the older image for the new container

Open dcodesdev opened this issue 1 year ago • 3 comments

When I'm updating my container with docker rollout it creates two images, <dirname>_<service-name> and <dirname>-<service-name> (one of them separated by _ and the other by -)

These are two different images, one of them doesn't get updated (from days ago) and the other is the new one built by docker-compose -f <file>.yaml build backend just before running docker rollout

The problem is that when running docker rollout -f <filename> it creates a new container but uses the older image therefore it doesn't update anything.

I don't know what is happening behind the scenes but took me hours of debugging until I found out the issue was docker rollout.

dcodesdev avatar May 25 '24 11:05 dcodesdev

I added the image field for the docker-compose.yaml file, now it works.

But the bug still exists if you don't specify an image field for your service.

dcodesdev avatar May 25 '24 16:05 dcodesdev

The difference comes from using different tools. docker rollout uses docker compose(v2) over docker-compose (v1) if it's available. The naming convention must have changed and now hyphens are used instead of underscores.

I suggest using Docker Compose now, as docker-compose is deprected. It probably means replacing docker-compose with docker compose in your scripts 😃

If you want to keep using docker-compose instead, you can patch lines 34-42 (linked below) in the script to set COMPOSE_COMMAND=docker-compose.

https://github.com/Wowu/docker-rollout/blob/93a733199a4a02d183ef84d494611ac12ac99024/docker-rollout#L34-L42

wowu avatar May 27 '24 10:05 wowu

Makes sense!

Maybe add it to the caveats list in the readme file so that others don't make the same mistake as I did.

Thank you for your help!

dcodesdev avatar May 27 '24 12:05 dcodesdev

Good idea, I added a note to readme: https://github.com/wowu/docker-rollout/commit/7487c2da51f91044c8efcc3794b02ad2957e9673

wowu avatar Nov 03 '24 09:11 wowu