Home > Blockchain >  How to create a new Docker image from a container without an image
How to create a new Docker image from a container without an image

Time:07-05

I have a running container but I deleted the original image it was based off and I thought by using docker commit <container-name> I could create a new image from my running container.

But I get the following error:

Error response from daemon: failed to get digest sha256:19d9e777d6b04fa62fcaac1a98dcdb11ec94e8ffb2c3c4d3ace2d81b210fc6b4: open /var/lib/docker/image/overlay2/imagedb/content/sha256/19d9e777d6b04fa62fcaac1a98dcdb11ec94e8ffb2c3c4d3ace2d81b210fc6b4: no such file or directory

I cannot redownload the original image I deleted because it was custom. I just want to create a new image from a container which is running already. What can I do?

CodePudding user response:

Nothing can be done. Its like you deleted the executable of which an instance is running in memory. Now the original executable can't be created from that. Same goes here.

Most probably that lost image won't be a base image unless that is the case in reality, so try to find the docker file / commands that helped created that custom image and try to recreate that. and Don't forget to push it some registry this time.

CodePudding user response:

Do u have the dockerfile u built the image ? if so you can try to rebuild it again and then use that image to create containers from that again.. make sure to push to a registry

  • Related