Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to import and export Docker containers

Shulou Source: shulou.com Published: 2022-06-01 21:26:39 10月02日 Update

How do I import and export Docker containers? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Method 1: import and export of containers (export and import)

1. View the containers to be exported

Docker ps-a

2. Export export

The exported tar file is transferred to the machine to be imported.

Docker export container name or the path to the ID > export of the container and the name of the tar package

Docker export centos > centos.tar

3. Import import

Docker import tar package path Custom Image name: TAG (default is latest)

Docker import centos.tar test/centos

There is already a new image on this new machine, and you can use this image to generate the container directly.

Method 2: export and import of images (save and load)

1. Save the image

Docker save > Custom tar package name Image name: TAG (default is latest)

Docker save > mysql.tar pinpointdocker/pinpoint-mysql:1.8.3

2. Import load

Docker load < mysql.tar

The difference between docker export and docker save

1. Docker save saves the image (image) and docker export saves the container (container)

2. Docker load is used to load the mirror package, and docker import is used to load the container package, but both of them will be restored to image.

After reading the above, have you mastered how to import and export Docker containers? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Container image method content name more machine path problem helpless for this reason name this skills documents articles experience industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Technology Shulou Tech Info vpn Docker