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

Solution to MySQL master-slave delay problem

Today we will look at why master-slave delay occu...

Examples of importing and exporting MySQL table data

This article describes the import and export oper...

Vue realizes web online chat function

This article example shares the specific code of ...

How to use Nginx to handle cross-domain Vue development environment

1. Demand The local test domain name is the same ...

Brief analysis of the various versions of mysql.data.dll driver

Here is the mysql driver mysql.data.dll Notice: T...

Detailed explanation of MySQL foreign key constraints

Official documentation: https://dev.mysql.com/doc...

JavaScript to implement the aircraft war game

This article shares with you how to use canvas an...

How to visualize sketched charts in Vue.js using RoughViz

introduce A chart is a graphical representation o...

HTML table_Powernode Java Academy

To draw a table in HTML, use the table tag tr me...

How to shut down/restart/start nginx

closure service nginx stop systemctl stop nginx s...

MySQL query optimization: a table optimization solution for 1 million data

1. Query speed of two query engines (myIsam engin...