Difference: The docker load command imports the image library storage file to the local image library; the docker import command imports a container snapshot to the local image library. Container snapshots will discard all history and metadata information, while image storage files will retain complete records and will be larger in size.
First of all, if you want to clearly understand the difference between the docker load
and docker import
commands, you must understand the image Differences from containers:
The image is the basis of the container. It can be simply understood that the image is the image we need to start the virtual machine. The container is the service that runs after the virtual machine is successfully started.
If you want to understand the difference between the docker load
and docker import
commands, you must also know the docker save
and docker export
Command:
docker save images_name
: Export an image as a file, and then use the docker load
command to import the file as an image. Save all history of this image. It is larger than the file exported by the docker export
command and is easy to understand because all the history of the image will be saved. docker export container_id
: Export a container as a file, and then use the docker import
command to import the container into a new image, but compared to docker save
command, the container file will lose all metadata and history records, and only save the current state of the container, which is equivalent to a virtual machine snapshot.
The difference between docker import and docker load
In fact, you can use the docker load command to import the image library storage file to the local image library , you can also use the docker import command to import a container snapshot into the local image library.
The difference between the two is that container snapshots will discard all historical records and metadata information, while image storage files will save complete records and will be larger in size. In addition, when importing from a container snapshot file, you can also re-specify metadata such as tags.
Recommended tutorials: "docker tutorial", "PHP tutorial"
The above is the detailed content of What is the difference between docker import and docker load?. For more information, please follow other related articles on the PHP Chinese website!