Following scenario:
- Run container with
docker-compose up
- You now have a container with e.g. the image
example
listed indocker ps
- Now build a new
example
image withdocker-compose build
The still running container will now be renamed in docker ps
from the previous image name to a short SHA256 and with docker images
it’ll be marked as <none>
.
Question: Now how do I get the real image name it was before it got disconnected/renamed?
I tried to go up the parent tree by doing:
docker image inspect OLD_CONTAINER_RENAMED_IMAGE_SHA256 | jq '.[] | "\(.RepoTags) \(.Parent)"'
and then entering the Parent
it returns instead of OLD_CONTAINER_RENAMED_IMAGE_SHA256
, until I eventually reach something that has no parent and has a set RepoTags
.
Issue with my solution: Now that works to a certain degree, but if my original image was called “example” it now returns back “nginx” which was the FROM:
of my actual image instead.