-1

Created an ubuntu docker image. (no commits, no backups) Decided to practice and delete.

But only now I realized that I can't restore the rest :) Can restore as GIT, past images by name,ID ?

  • docker run -it ubuntu ps -A
  • docker ps -a
  • docker rm $(docker ps -aq)
  • docker images
  • docker rmi ubuntu:laters
  • docker rmi $(docker images -q) #overdid it
  • docker images
  • docker ps -a

p.s. - also read that there are saves in folders /var/lib/docker/volumes/

  • 4
    Just rebuild from the Dockerfile. That's the way it's supposed to work, at least. – SiHa Nov 21 '20 at 17:34
  • to be able to restore images, do I need to commit and create backups? or is there a simple restore command? – Yaroslav Ko Nov 21 '20 at 17:45
  • Check your Dockerfile in to source control, and then you can rebuild it as @SiHa suggests. Never run `docker commit`. – David Maze Nov 21 '20 at 20:15

1 Answers1

1

To create a version of Docker images, you can store your image in Amazon ECR. If the source code is not changed, then you can rebuild the image from the Dockerfile and it will be the same.

If there is change in the source code, and you are using version control for your code, then you can checkout to that commit and build the Docker image again.