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

Docker Nginx container production and deployment implementation method

Quick Start 1. Find the nginx image on Docker Hub...

Pure HTML and CSS to achieve JD carousel effect

The JD carousel was implemented using pure HTML a...

Summary of ten principles for optimizing basic statements in MySQL

Preface In the application of database, programme...

Detailed explanation of how to use zabbix to monitor oracle database

1. Overview Zabbix is ​​a very powerful and most ...

Detailed code for adding electron to the vue project

1. Add in package.json "main": "el...

How to understand JavaScript modularity

Table of contents 1. Browser support 2. export ex...

Basic principles of MySQL scalable design

Table of contents Preface 1. What is scalability?...

Detailed explanation of MySQL injection without knowing the column name

Preface I feel like my mind is empty lately, as I...

Sample code for implementing music player with native JS

This article mainly introduces the sample code of...

XHTML introductory tutorial: Application of table tags

<br />Table is an awkward tag in XHTML, so y...

Vue.js front-end web page pop-up asynchronous behavior example analysis

Table of contents 1. Preface 2. Find two pop-up c...

Sample code for a simple seamless scrolling carousel implemented with native Js

There are many loopholes in the simple seamless s...

Semantic web pages XHTML semantic markup

Another important aspect of separating structure ...