Reputation: 6497
My server is having some weird bug I cannot find so I just deleted all docker images and downloaded them again. Weirdly the same bug now also appears in the updated version of the server. My hunch is, that docker does not download the exact same images but rather some updated versions which cause this bug.
Question is, how do I force docker to use the exact same versions as before?
Looking at my docker-compose.yml I can see that rabbitmq and mongo have differen "created" dates although their version number is specified in the docker-compose file:
services:
messageq:
image: rabbitmq:3
container_name: annotator_message_q
environment:
- RABBITMQ_DEFAULT_USER=user
- RABBITMQ_DEFAULT_PASS=password
networks:
- cocoannotator
database:
image: mongo:4.0
container_name: annotator_mongodb
restart: always
environment:
- MONGO_DATA_DIR=/data/db
- MONGO_LOG_DIR=/dev/null
volumes:
- "mongodb_data:/data/db"
command: "mongod --smallfiles --logpath=/dev/null"
Is the specification rabbitmq:3 and mongo:4.0 not specific enough?
Upvotes: 2
Views: 2401
Reputation: 2076
Is the specification rabbitmq:3 and mongo:4.0 not specific enough?
It is not. Tags are mutable in Docker Hub and in other docker registries by default. This means, that you may have unlimited number of actual images - all registered as rabbitmq:3.
Full proof specific version variant is to use sha256 digests. This is the only recommended way for live systems. I.e. instead of rabbitmq:3
, use
rabbitmq:3@sha256:fddabeb47970c60912b70eba079aae96ae242fe3a12da3f086a1571e5e8c921d
Unfortunately for your case, if you have already deleted all your images, you may not be able to recover what was the exact version. If you still have them somewhere, then do something like docker images | grep rabbitmq
and then docker image inspect
on matching images to find out their sha256 digests.
Upvotes: 2