Docker packages the local image and restores it to other machines

Docker packages the local image and restores it to other machines

1. Use docker images to view all the image files on this machine

2. docker save eb40dcf64078> /root/mydjango-save-1016.tar Save the image as a local file, where eb40dcf64078 is the image id

3. Upload the files saved locally to the server that cannot be pulled. The network is connected. I use the scp command directly here.

4. Use the load method to load the tar file just uploaded

docker load < /root/mydjango-save-1016.tar

5. Use the docker images command on the new machine to view the local image and check whether the image just loaded is loaded. It is found that the image name and tag loaded are both none. Use docker tag eb40dcf64078 django:latest to modify them to the original image name and tag name, where eb40dcf64078 is the images id.

6. Use docker run -itd django:latest to load and verify whether the image can be successfully "run"

Additional knowledge: Docker image import and export, image renaming. Can be used to deploy Docker applications offline

Exporting an Image

Docker images view image id and name

Export using imageId (not recommended)

docker save -o fileName.tar imageId

However, I found a problem that the image exported using imageId has both the repository and name as none when imported. However, when the image is exported using the image name and then imported again, none appears.

The reason for this error is that when docker loads, the image with the same name will be overwritten and the original image will be renamed, resulting in the problem shown in the figure above.

To rename an image:

docker tag [image id] [new image name]:[new image tag]

demo

docker tag 6982b35ff928 zookeeper

Export using imageName (recommended)

docker save -o ./fileName.tar imageName

demo

docker save -o ./portainer.tar portainer/portainer

Importing an Image

docker load -i < ./fileName.tar

demo

The above article about docker packaging local images and restoring them to other machines is all I have to share with you. I hope it can give you a reference, and I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Implementation of Docker packaging image and configuration modification
  • How to use Docker to package and deploy images locally
  • Detailed explanation of how to use Docker to deploy a web project and package it into an image file
  • Using jib to package docker images
  • Detailed explanation of Docker container basic system image packaging
  • Use scripts to package and upload Docker images with one click

<<:  How to call a piece of HTML code together on multiple HTML pages

>>:  js to realize simple shopping cart function

Recommend

How to implement second-level scheduled tasks with Linux Crontab Shell script

1. Write Shell script crontab.sh #!/bin/bash step...

Ubuntu 15.04 opens mysql remote port 3306

Ubuntu 15.04 opens MySQL remote port 3306. All th...

Use of Linux bzip2 command

1. Command Introduction bzip2 is used to compress...

Analysis of SQL integrity constraint statements in database

Integrity constraints Integrity constraints are f...

Several popular website navigation directions in the future

<br />This is not only an era of information...

Tutorial on using iostat command in Linux

Preface It is said that if the people doing opera...

Implementation of Portals and Error Boundary Handling in React

Table of contents Portals Error Boundary Handling...

How to manually upgrade the kernel in deepin linux

deepin and Ubuntu are both distributions based on...

JavaScript realizes the queue structure process

Table of contents 1. Understanding Queues 2. Enca...

How to publish a locally built docker image to dockerhub

Today we will introduce how to publish the local ...

How to elegantly implement the mobile login and registration module in vue3

Table of contents Preface Input box component lay...

Solve the margin: top collapse problem in CCS

The HTML structure is as follows: The CCS structu...