Detailed explanation of the working principle and usage of the Docker image submission command commit

Detailed explanation of the working principle and usage of the Docker image submission command commit

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

Now let’s put it into practice.

docker pull nginx:1.15.3 

Start a container using the command line:

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

localhost:1080

Enter the container's shell:

docker exec -it jerry-nginx /bin/bash

View the default homepage of this nginx image:

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

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

Use the wget command to download an image file and an HTML file to the location where the Nginx server stores the web page:

wget --no-check-certificate -O /usr/share/nginx/html/evil.jpg https://github.com/raw/slvi/docker-k8s-training/master/docker/res/evil.jpg
wget --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 them.

docker commit jerry-nginx jerry-modify-nginx:1.0 

Use the command to set 1.0 as the latest tag:

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

Use docker stop jerry-nginx to stop the old container, and then start the modified container jerry-modify-nginx:

docker history View the history of this new image:

Execute the command to label this 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 full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Submit the image through the container DockerCommit and push the image DockerPush
  • Docker image creation Dockerfile and commit operations
  • Docker learning notes: How to commit a container to an image
  • Detailed explanation of Docker modifying existing images (commit)
  • Detailed explanation of Docker learning to create an image using the commit command
  • Docker image commit operation example and function

<<:  Complete steps for uninstalling MySQL database

>>:  Detailed explanation of 8 ways to pass parameters in Vue routing components

Recommend

Summary of principles for writing HTML pages for emails

Since HTML email is not an independent HOST page o...

Detailed explanation of generic cases in TypeScript

Definition of Generics // Requirement 1: Generics...

Solution to the cross-domain problem of SpringBoot and Vue interaction

Table of contents Browser Same Origin Policy 1. V...

Detailed explanation of how to dynamically set the browser title in Vue

Table of contents nonsense text The first router/...

Reflection and Proxy in Front-end JavaScript

Table of contents 1. What is reflection? 2. Refle...

CSS -webkit-box-orient: vertical property lost after compilation

1. Cause The requirement is to display two lines,...

Detailed explanation of crontab scheduled execution command under Linux

In LINUX, periodic tasks are usually handled by t...

Sample code for JS album image shaking and enlarging display effect

The previous article introduced how to achieve a ...

Specific use of Mysql prepare preprocessing

Table of contents 1. Preprocessing 2. Pretreatmen...

The best solution for resetting the root password of MySQL 8.0.23

This method was edited on February 7, 2021. The v...

Detailed explanation of Tomcat configuration and optimization solutions

Service.xml The Server.xml configuration file is ...

Django online deployment method of Apache

environment: 1. Windows Server 2016 Datacenter 64...