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

Docker /var/lib/docker/aufs/mnt directory cleaning method

The company's service uses docker, and the di...

Implementing calculator functions with WeChat applet

This article is a simple calculator written using...

Detailed explanation of basic concepts of HTML

What is HTML? HTML is a language used to describe...

CSS3 uses transform to create a moving 2D clock

Now that we have finished the transform course, l...

Implementation of CSS3 3D cool cube transformation animation

I love coding, it makes me happy! Hello everyone,...

Two ways to completely delete users under Linux

Linux Operation Experimental environment: Centos7...

Solution to the problem that Docker container cannot be stopped or killed

Docker version 1.13.1 Problem Process A MySQL con...

How to make ApacheBench support multi-url

Since the standard ab only supports stress testin...

An article teaches you how to use Vue's watch listener

Table of contents Listener watch Format Set up th...

How to install docker under centos and remotely publish docker in springboot

Table of contents 1. Installation of JDK1.8 under...

About MariaDB database in Linux

Table of contents About MariaDB database in Linux...

HTML text escape tips

Today I saw a little trick for HTML text escaping ...

Super detailed MySQL usage specification sharing

Recently, there have been many database-related o...

The submit event of the form does not respond

1. Problem description <br />When JS is use...

HTML implements a fixed floating semi-transparent search box on mobile

Question. In the mobile shopping mall system, we ...