Example of exporting and importing Docker containers

Example of exporting and importing Docker containers

This article mainly explains the import and export of Docker containers, which can be used as a backup for container snapshots.

Exporting Docker containers

1. First use the command to view the created Docker container

 docker ps -a 

insert image description here

At this time, you can see container id , which is the container ID. We can export the corresponding container based on the container ID.

2. Export a container

Exporting a container is very simple. Use the docker export command. The syntax is: docker export $container_id > 容器快照名

insert image description here

3. View the exported container

 ls 

insert image description here

4. Download the container

View the current path

 pwd 

insert image description here

Knowing that the container path is under tmp, we can directly use the FTP remote tool to connect to the host to download:

insert image description here

Wait for the container file to download

insert image description here

Importing Docker containers

Import a container – docker import command

Now that we have a container snapshot, we can import it whenever we want. Import snapshots using the docker import command.

1. First go to the directory where the container file is located

As mentioned above, the directory exported by the container is under tmp, so let's go directly to the tmp directory

 cd /tmp 

insert image description here

2. Import container

 docker import halo.tar halo:latest

OPTIONS description:

-halo.tar : select the container file name to import
-halo:latest : Specify container name and version

The import and export process is similar, so I won’t show you the pictures here.

3. You can delete the container file after you are done

 rm -rf /tmp/halo.tar

This is the end of this article about exporting and importing Docker containers. For more information about exporting and importing Docker containers, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • 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
  • Tutorial on importing and exporting Docker containers
  • 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

<<:  HTML+Sass implements HambergurMenu (hamburger menu)

>>:  5 basic skills of topic page design (Alibaba UED Shanmu)

Recommend

Apache Spark 2.0 jobs take a long time to finish when they are finished

Phenomenon When using Apache Spark 2.x, you may e...

A brief introduction to mysql mycat middleware

1. What is mycat A completely open source large d...

Introduction to RHCE bridging, password-free login and port number modification

Table of contents 1. Configure bridging and captu...

Solve the problem that ifconfig and addr cannot see the IP address in Linux

1. Install the Linux system on the virtual machin...

Detailed explanation of the platform bus of Linux driver

Table of contents 1. Introduction to platform bus...

JavaScript implements mouse control of free moving window

This article shares the specific code of JavaScri...

IE6 space bug fix method

Look at the code: Copy code The code is as follows...

How to create a file system in a Linux partition or logical volume

Preface Learn to create a file system on your sys...

MySQL case when usage example analysis

First we create the database table: CREATE TABLE ...

HTML form and the use of form internal tags

Copy code The code is as follows: <html> &l...

Object.entries usage you don't know in JavaScript

Table of contents Preface 1. Use for...of to iter...

How to use mysqladmin to get the current TPS and QPS of a MySQL instance

mysqladmin is an official mysql client program th...

MySQL SQL statement performance tuning simple example

MySQL SQL statement performance tuning simple exa...

Detailed steps for quick installation of openshift

The fastest way to experience the latest version ...

Summary of the use of TypeScript in React projects

Preface This article will focus on the use of Typ...