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

Explain in detail the working principle and usage of the Docker image submission command commit

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

After creating a container locally, you can create a local image based on the container, and push the image to Docker hub for download and use on the network.

Let's put it into practice.

Docker pull nginx:1.15.3

Start a container with the command line:

Docker run-d-p 1080 docker run-- name jerry-nginx nginx:1.15.3

Localhost:1080

Enter the shell of the container:

Docker exec-it jerry-nginx / bin/bash

Check the default home page of this nginx image:

I want to use wget in the container, so install it first:

Apt-get update & & apt-get-y install wget

Use the wget command to download an image file and a html file to the location of the Nginx server where the web page is stored:

Wget-- no-check-certificate-O / usr/share/nginx/html/evil.jpg https://github.com/raw/slvi/docker-k8s-training/master/docker/res/evil.jpgwget-- no-check-certificate-O / usr/share/nginx/html/index.html https://github.com/raw/slvi/docker-k8s-training/master/docker/res/evil.html

Refresh the page, and the page we see now has become the page downloaded by wget:

We now want to solidify the changes found in this container so that others can use it.

Docker commit jerry-nginx jerry-modify-nginx:1.0

Use the command to set 1.0 to latest tag:

Docker tag jerry-modify-nginx:1.0 jerry-modify-nginx:latest

Stop the old container with docker stop jerry-nginx, and then start the modified container jerry-modify-nginx:

Docker history name to view the history of this new image:

Execute the command to label the new image:

Docker tag jerry-modify-nginx:latest registry.ingress.shcw46.k8s-train.shoot.canary.k8s-hana.ondemand.com/jerry-modify-nginx:760d7ca6

Push the tagged image to the remote end:

Docker push registry.ingress.shcw46.k8s-train.shoot.canary.k8s-hana.ondemand.com/jerry-modify-nginx:760d7ca6

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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