I have the most frustrating issue ever with docker-compose:
I push a new image to gitlab, run docker compose on the server and.. the old image runs.
and.. I'm still getting a container with the old image. I don't even know where it gets the image from since I have wiped them with docker rmi...
now, if I do a docker run gitlabimagepath, the new image runs properly. so, on the same computer the issue is specifically happening with docker-compose, not with docker.
docker-compose pull is getting an image with the proper digest. when I run it with docker-compose and get the old image, or I run with docker run, the inspection gives the same image sha256. So it looks like there is some old container that keeps being resurrected for docker-compose and never gets rebuilt
I can't think of a better question than 'what the hell?'
nothing from this similar question docker-compose keeps using old image content helps at all.
The docker compose is very basic:
version: '3.3'
services:
leech:
container_name: services_leech
image: registry.gitlab.com/...:latest
restart: unless-stopped
volumes:
- volume-leech:/app
networks:
- default
volumes:
volume-leech:
networks:
default:
external:
name: leech-network
so, one permanent storage volume and this is it.
When you declare a named volume to be mounted on /app:
volumes:
- volume-leech:/app
Both the application code and its local data are stored in the volume. Docker has no way to tell these apart, so even when the underlying image gets updated, the older code in the volume winds up taking precedence.
If you can reconfigure or restructure your application to store its data somewhere else, you can change the Docker setup to
volumes:
- volume-leech:/app/data
and then the main code in /app will come from the image, and only the data will be stored in the named volume.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With