Complete steps for Docker to pull images

Complete steps for Docker to pull images

1. Docker pull pulls the image

When using $ docker pull {IMAGE_NAME} to pull an image, there are two situations:

  • IMAGE_NAME has a domain name before the first slash

Docker will recognize IMAGE_NAME as an image with a domain name. For example, myregistry.io/space1/image1:latest, Docker will go to the server pointed to by myregistry.io to request the image data. A Docker image is divided into many layers. If the layer exists locally, it will not be pulled again.

  • There is no domain name before the first slash in IMAGE_NAME

Docker will concatenate IMAGE_NAME to docker.io/IMAGE_NAME to request the image data. In fact, $ docker pull docker.io/shaowenchen/images1 is equivalent to $ docker pull shaowenchen/images1. For the images provided by DockerHub, the access speed in China is slow, which can be accelerated by adding image sources.

When pulling images, there may be two problems:

1. Pull the non-public image and prompt to log in

Simply log in using docker login. In a non-interactive scenario, you can execute:

$ echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin

2. Mirror repository certificate error

If the image repository server is specified in IMAGE_NAME, but the server does not provide a valid https service, the following configuration is required:

In the /etc/docker/daemon.json file, add:

{
 "insecure-registries": ["core.harbor.chenshaowen.com:5000"]
}

Restart Docker for the changes to take effect.

2. Modify the image source to speed up image pulling

  • Modify the Docker configuration file daemon.json

In the /etc/docker/daemon.json file, add the mirror source

{ 
 "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"] 
}
  • Modify Docker's systemd parameters

Edit the file /usr/lib/systemd/system/docker.service and add the registry-mirror parameter to the line containing ExecStart.

ExecStart=... --registry-mirror=https://docker.mirrors.ustc.edu.cn

Restart Docker for the changes to take effect.

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Solution to Docker push image failure
  • How to pull the docker image to view the version
  • How to delete an image in Docker
  • How to export and import images between docker
  • A detailed introduction to Docker image creation, how to modify and upload images, etc.
  • How to delete the none image in docker
  • Detailed explanation of the difference between Docker images and containers
  • Detailed explanation of two methods of creating Docker images
  • Configure domestic image settings in Docker
  • An article to understand the creation, uploading, pulling and deployment of Docker images

<<:  Vue custom components use event modifiers to step on the pit record

>>:  Summary of problems that may occur when using JDBC to connect to Mysql database

Recommend

How to design a web page? How to create a web page?

When it comes to understanding web design, many p...

5 MySQL GUI tools recommended to help you with database management

There are many database management tools for MySQ...

Navicat connects to MySQL8.0.11 and an error 2059 occurs

mistake The following error occurs when connectin...

Detailed introduction to the MySQL installation tutorial under Windows

Table of contents 1. Some concepts you need to un...

Vue implements user login and token verification

In the case of complete separation of the front-e...

The role of nextTick in Vue and several simple usage scenarios

Purpose Understand the role of nextTick and sever...

Docker image cannot be deleted Error: No such image: xxxxxx solution

Preface The docker image cannot be deleted. Check...

react+antd.3x implements ip input box

This article shares the specific code of react+an...

Detailed explanation of Vue mixin

Table of contents Local Mixin Global Mixins Summa...

Example code for implementing WeChat account splitting with Nodejs

The company's business scenario requires the ...

Explanation of the execution priority of mySQL keywords

As shown below: from table where condition group ...

The difference and usage of Vue2 and Vue3 brother component communication bus

Table of contents vue2.x vue3.x tiny-emitter plug...

Detailed explanation of TIMESTAMPDIFF case in MySQL

1. Syntax TIMESTAMPDIFF(unit,begin,end); Returns ...

A brief discussion on how to customize the host file in Docker

Table of contents 1. Command 2. docker-compose.ym...