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

Docker pull image and tag operation pull | tag

I re-read the source code of the Fabric project a...

How to use Nginx to proxy multiple application sites in Docker

Preface What is the role of an agent? - Multiple ...

Javascript tree menu (11 items)

1. dhtmlxTree dHTMLxTree is a feature-rich Tree M...

Mysql delete duplicate data to keep the smallest id solution

Search online to delete duplicate data and keep t...

Detailed steps for installing JDK and Tomcat on Linux cloud server (recommended)

Download and install JDK Step 1: First download t...

Vue routing relative path jump method

Table of contents Vue routing relative path jump ...

How to use Docker-compose to deploy Django applications offline

Table of contents Install Docker-ce for the devel...

Centos8 bridge static IP configuration method in VMware virtual machine

1. Make sure the network connection method is bri...

Installation method of MySQL 5.7.18 decompressed version under Win7x64

Related reading: Solve the problem that the servi...

MySQL query specifies that the field is not a number and comma sql

Core SQL statements MySQL query statement that do...

Tomcat maxPostSize setting implementation process analysis

1. Why set maxPostSize? The tomcat container has ...

Web Design Tutorial (4): About Materials and Expressions

<br />Previous Web Design Tutorial: Web Desi...

You may not know these things about Mysql auto-increment id

Introduction: When using MySQL to create a table,...

How to mount the CD to find the rpm package under Linux

Written in front Sometimes you need to install so...

Vue implements three-dimensional column chart based on echarts

The three-dimensional column chart consists of th...