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

JavaScript array reduce() method syntax and example analysis

Preface The reduce() method receives a function a...

Handwritten Vue2.0 data hijacking example

Table of contents 1: Build webpack 2. Data hijack...

Use and understanding of MySQL triggers

Table of contents 1. What is a trigger? 2. Create...

Solve the cross-domain problem of get and post requests of vue $http

Vue $http get and post request cross-domain probl...

Some questions about hyperlinks

<br />I am very happy to participate in this...

In-depth understanding of Vue transition and animation

1. When inserting, updating, or removing DOM elem...

Detailed explanation of MySQL sql_mode query and setting

1. Execute SQL to view select @@session.sql_mode;...

JS uses map to integrate double arrays

Table of contents Preface Simulating data Merged ...

Getting Started with Mysql--sql execution process

Table of contents 1. Process 2. Core Architecture...

On good design

<br />For every ten thousand people who answ...

Vue Router vue-router detailed explanation guide

Chinese documentation: https://router.vuejs.org/z...

How to automatically execute SQL statements when MySQL in Docker starts

When creating a MySQL container with Docker, some...