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

The working principle and usage of the Docker Image submission Command commit

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

Share

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

This article mainly explains the "Docker image submission command commit working principle and how to use", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "Docker image submission command commit working principle and usage" bar!

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

Sha256:7e243a7b4c0796e3a787fe963224fdf1fe81d9fe9b283f6f3e4f17e1defa0c96

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

Thank you for your reading, the above is the "Docker image submission command commit working principle and how to use" the content, after the study of this article, I believe you on the Docker image submission command commit working principle and usage of this problem have a deeper understanding, the specific use of the need for you to practice verification. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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