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

Tutorial on installing mysql5.7.18 on mac os10.12

I searched the entire web and found all kinds of ...

Example usage of Linux compression file command zip

The ".zip" format is used to compress f...

express project file directory description and detailed function description

app.js: startup file, or entry file package.json:...

Solution to PHP not being able to be parsed after nginx installation is complete

Table of contents Method 1 Method 2 After install...

Docker starts MySQL configuration implementation process

Table of contents Actual combat process Let's...

MySQL 5.7.18 MSI Installation Graphics Tutorial

This article shares the MySQL 5.7.18 MSI installa...

HTML+CSS project development experience summary (recommended)

I haven’t updated my blog for several days. I jus...

Detailed explanation of ES6 Promise usage

Table of contents What is a Promise? Usage of rej...

Develop a vue component that encapsulates iframe

Table of contents 1. Component Introduction 2. Co...

This article will show you the principle of MySQL master-slave synchronization

Table of contents Brief Analysis of MySQL Master-...

10 excellent Web UI libraries/frameworks

1. IT Mill Toolkit IT Mill Toolkit is an open sou...