Detailed explanation of the basic commands of Docker run process and image

Detailed explanation of the basic commands of Docker run process and image

1. Run workflow

When we install the Docker engine, we will verify that the Docker Engine has been installed correctly by running the hello-world image:

Let's analyze the execution flow of the run command: The execution flow chart of run is as follows

When we try to run an image that is not found on our local machine or in DockerHub:

First start the Docker engine:

systemctl start docker

Then test it:

docker run wanliguyicheng123456789

Docker returns an error that the image cannot be found.

2. Basic commands of mirroring

List mirrors

We can use docker images to list the images on the local host.

Description of each option:

  • REPOSITORY: indicates the repository source of the image
  • TAG: image tag
  • IMAGE ID: The ID of the image. All images are identified by a 64-bit hexadecimal string (a 256-bit value internally). To simplify usage, the first 12 characters can be used to form a short ID that can be used in the command line. There is still a certain chance of collision for short IDs, so the server always returns the long ID.
  • CREATED: The time when the image was created
  • SIZE: The size of the image

Note: The same repository source can have multiple tags, representing different versions of this repository source.

Optional parameters:

Name, abbreviation describe
--all, -a List all images (intermediate images are hidden by default)
--quiet, -q Only display the image ID
docker images -q
feb5d9fea6a5   

Search Mirror

We can search for images from the Docker Hub website. The Docker Hub website is: https://hub.docker.com. For example, if we want to search for the mysql image:

You can also use the docker search command to search for the mysql image.

docker search mysql

Description of each option:

  • NAME: The name of the image repository source
  • DESCRIPTION: Description of the image
  • OFFICIAL: Whether it is officially released by Docker
  • STARS: Similar to the star in Github, it means like or like.
  • AUTOMATED: Automatically built.

Optional parameters:

Name, abbreviation describe
--filter, -f Filter the output based on the provided criteria

Search STARS for more than 3000 mysql images:

docker search mysql -f=stars=3000

Download image

grammar:

docker pull [OPTIONS] NAME[:TAG|@DIGEST]

OPTIONS description:

  • -a : pull all tagged images
  • --disable-content-trust : Ignore image verification, enabled by default

Test: Use the command docker pull to download the mysql image

docker pull mysql

Download the specified version of the MySQL image: First, the version must be supported in Docker Hub

docker pull mysql:5.7

Use the docker images command again to view the downloaded image:

Deleting an image

Delete by image name:

docker rmi -f mysql

Parameter description: -f: forced deletion

To delete by image ID:

docker rmi -f 8b43c6af2ad0

Delete multiple images: separate multiple image IDs with spaces

docker rmi -f image_id image_id image_id image_id

Delete all images: first find out all image IDs, and then delete the images one by one by image ID

docker rmi -f $(docker images -aq)

All images have been deleted!

Docker Commands

The above is the detailed content of the Docker run process and the basic commands of the image. For more information about Docker, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Detailed explanation of the working principle and usage of the Docker image submission command commit
  • Summary of common Docker commands: installation, mirroring, and basic container operations
  • Detailed explanation of Docker learning to create an image using the commit command
  • A detailed introduction to the Dockerfile image building file and related commands in Docker
  • Summary of Docker's commonly used commands for clearing container images
  • Docker image pull login upload and save and other related commands

<<:  CSS3 radar scan map sample code

>>:  Function overloading in TypeScript

Recommend

Five ways to traverse JavaScript arrays

Table of contents 1. for loop: basic and simple 2...

Sample code for automatic web page refresh and automatic jump

Automatic web page refresh: Add the following code...

Detailed explanation of three ways to wrap text in el-table header

Table of contents Problem Description Rendering T...

Examples of using the ES6 spread operator

Table of contents What are spread and rest operat...

How to view and optimize MySql indexes

MySQL supports hash and btree indexes. InnoDB and...

Vue shopping cart case study

Table of contents 1. Shopping cart example 2. Cod...

Solve the MySQL login 1045 problem under centos

Since the entire application needs to be deployed...

Detailed analysis and usage of tcpdump command under Linux

Introduction To put it simply, tcpdump is a packe...

File sharing between Ubuntu and Windows under VMware

This article records the method of sharing files ...

The process of using vxe-table to make editable tables in vue

There is a table in the project that needs to be ...

5 solutions to CSS box collapse

First, what is box collapse? Elements that should...

HTML tags list and usage instructions

List of HTML tags mark type Name or meaning effec...

Detailed explanation of how to use Tomcat Native to improve Tomcat IO efficiency

Table of contents Introduction How to connect to ...