Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to migrate a local docker container to the server

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to migrate the local docker container to the server. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Generate an image from a docker container

Docker commit-a "zhaoolee"-m "complete the configuration of uwsgi" qs zhaoolee-qs:1.0

Parameter description:-an is the signature of the author,-m is the description of the content of this submission, qs is the name of the container, zhaoolee-qs:1.0 indicates that the name of the newly generated image is zhaoolee-qs, and the image zhaoolee-qs version number is 1.0.

It can take a long time to generate an image from the container, so you need to wait patiently

Export a docker image as a static file

Docker save zhaoolee-qs:1.0 > qs01.tar

Zhaoolee-qs:1.0 is the image name, and qs01.tar is the newly generated static file name.

Send static files to the server by sending scp

Scp. / qs01.tar root@192.168.214.162:/qs01.tar

. / qs01.tar indicates the static file qs01.tar under the current local path, root@192.168.214.162 indicates that the login ip is 192.168.214.162 server as root, and / qs0.tar indicates that the qs01.tar will be stored in the root directory of the remote server, and the file name remains qs01.tar

Scp remote copy is a command worth mastering, simple and practical, and can also be used with script programming.

Restore the static file to a mirror and import it into docker

Docker load < qs01.tar

Log in to 192.168.214.162, go to the root directory (where qs01.tar is located), and run this command to restore the image and import it into docker Manager.

Create a new container from the image you just imported

Docker run-t-I-- name qs01-p 3000 zhaoolee-qs:1.0 80-p 8000 zhaoolee-qs:1.0 / bin/bash

Tip: exit the current container environment without closing the current container ctrl+p+q

This is the end of the article on "how to migrate local docker containers to the server". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report