Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to save images in docker container

Shulou Source: shulou.com Published: 2022-06-01 11:45:24 10月02日 Update

This article introduces the knowledge of "how to save images in docker containers". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

How does the docker container save the image? Docker submits the specified container to save as a new image, you can use the command: docker commit

Image preservation method 1: save

The save command saves the image in its entirety, including historical versions and metadata information, so the file may be large.

Sudo docker save-o / home/admin/dockerImages/mmm.tar ubuntu:12.04 # now generally has an image repository for docker, and generally does not use this method.

-o: export as a file followed by the location where the export file is saved and finally the image (repository: TAG, or image id)

Image preservation method 2: export

Specifically, export is actually the preservation of the container, only the current state of the image is saved, there is no historical version and other information, all the files are relatively small.

-o: export as a file followed by-o is the location where the exported file is saved

Finally, there is the id of the container, which is viewed through sudo docker ps-a.

Docker export-o ubuntu1204.tar d0751467dcad

This is the end of "how to save images in docker containers". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Mirrors containers files repositories locations information content history commands forms methods more versions knowledge practical large successful learning next dilemma reality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker OPPO Reno Apple macOS Linux