After doing extensive work on a very large image I accidently ran docker commit CONTAINER_ID
instead of docker commit CONTAINER_ID IMAGE
. My intention was to update the old image with the new work, but now I have two very large images instead:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 78aebb8ed5af 35 minutes ago 88.6GB
my-ubuntu latest a153f4458b1a 14 hours ago 28.8GB
How can I fix this, that is, have only a single image my-ubuntu
with the changes currently present only in the new image?
I tried docker image rm my-ubuntu
to keep only the new image which is more up to date, but this gives:
Error response from daemon: conflict: unable to delete my-ubuntu (cannot be forced) - image has dependent child images
I suppose that's because the new image was built from my-ubuntu
, but... I do not wish to delete the new image and re-do all the work and commit again. Is there any way this can be avoided?
This answer suggests deleting dangling images, but docker images --filter "dangling=true"
returns precisely the new image which I do not want to delete. This answer suggests creating a docker file from both images and generating a new image, but the output of that command for the new image is the same as for my-ubuntu
except a new sha256 entry with the work done on the new image, so should I just create a dockerfile from it and then an imagem from the dockerfile? I'm new to docker and unsure how to proceed.