Tutorial on importing and exporting Docker containers

Tutorial on importing and exporting Docker containers

background

The popularity of Docker is closely related to its easy sharing and portability of containers. Users can not only submit containers to public servers, but also export containers to local file systems. Similarly, we can also import the exported container back into the Docker runtime environment.

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

1. View the container that needs to be exported

docker ps -a

2. Export

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

docker export container name or container ID > exported path and tarball name

docker export centos> centos.tar

3. Import

docker import tarball path custom image name: TAG (default is latest)

docker import centos.tar test/centos 


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

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

1. Save the image

docker save > Customize tarball image name: TAG (default is latest)

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

2. Load import

docker load < mysql.tar 


The difference between docker export and docker save

1. Docker save saves the image, and Docker export saves the container.

2. Docker load is used to load image packages, and Docker import is used to load container packages, but both will be restored to images;

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Example of exporting and importing Docker containers
  • Docker image import and export code examples
  • Implementation of importing and exporting docker images
  • Docker image import, export, backup and migration operations
  • Docker image export, import and copy example analysis
  • How to import and export Docker images
  • How to export and import images between docker
  • Docker realizes export, import and data migration
  • Docker practice: importing and exporting containers
  • Docker image and container import and export operations practice

<<:  Vue2 implements provide inject to deliver responsiveness

>>:  mysql-5.7.21-winx64 free installation version installation--Windows tutorial detailed explanation

Recommend

Linux beginners in virtual machines configure IP and restart the network

For those who are new to virtual machines or have...

MySQL Practical Experience of Using Insert Statement

Table of contents 1. Several syntaxes of Insert 1...

Code for implementing simple arrow icon using div+CSS in HTML

In web design, we often use arrows as decoration ...

Use of align-content in flex layout line break space

1. The effect diagram implemented in this article...

JavaScript object built-in objects, value types and reference types explained

Table of contents Object Object Definition Iterat...

HTML Tutorial: DOCTYPE Abbreviation

When writing HTML code, the first line should be ...

SystemC environment configuration method under Linux system

The following is the configuration method under c...

In-depth explanation of the locking mechanism in MySQL InnoDB

Written in front A database is essentially a shar...

Distinguishing between Linux hard links and soft links

In Linux, there are two types of file connections...

Sequence implementation method based on MySQL

The team replaced the new frame. All new business...