Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker series-build local private warehouse-various pits for registry containers

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Summed up pit:

a. Pay attention to the writing format of daemon.json. There are several points that can be wrong in a sentence.

B.tag must clearly represent the information of the registry server in order to upload push successfully. It's not optional information.

There is a version number in c.tag that should be clearly written down. The automatic completion of the system is done with latest.

#

Build process:

Premise: registry downloaded through docker pull registry

1. New / etc/docker/daemon.json

[root@master docker] # cat daemon.json

{

"insecure-registries": ["172.17.0.1 VR 5000"]

}

The following error is reported because the newly created / etc/docker/daemon.json file has not been successful.

[root@master ~] # docker push 172.17.0.1:5000/hello-world

The push refers to repository [172.17.0.1:5000/hello-world]

Get https://172.17.0.1:5000/v2/: http: server gave HTTP response to HTTPS client

There are 4 error-prone areas:

a. Incorrectly written as insecure-registry.

b. Incorrectly written as http://172.17.0.1:5000

c. Incorrect use of container IP 172.17.0.2

d. Forgot to restart the docker service

#

two。 Whether the local registry has been successfully established can be checked through docker info.

[root@master docker] # docker info | grep-I-A 3 regis

Registry: https://index.docker.io/v1/

Labels:

Experimental: false

Insecure Registries:

172.17.0.1:5000

127.0.0.0/8

Live Restore Enabled: false

#

3. Start the local registry container, and push upload the image to the local registry container

Mkdir-p / data/registry

# # create a directory volume on host to store the container

Docker run-d-p 5000 5000-v / data/registry:/var/lib/registry-- name local_registry registry

# # launch the container and use port 5000 for external use. The first 5000 is the port of host, and the second 5000 is the container port.

[root@master docker] # docker ps | grep-I local_registry

B4c6b769aabc registry "/ entrypoint.sh / etc..." About an hour ago Up 30 minutes 0.0.0.0 5000/tcp local_registry 5000->

# # check whether the registry container is started

[root@master ~] # docker tag hello-world 172.17.0.1:5000/hello-world:v1

[root@master ~] # docker push 172.17.0.1:5000/hello-world:v1

The push refers to repository [172.17.0.1:5000/hello-world]

Af0b15c8625b: Pushed

V1: digest: sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a size: 524

[root@master ~] #

# # Note: docker tag hello-world 172.17.0.1:5000/hello-world:v1 must type the correct tag, that is, tag must clearly indicate which registry it is.

Otherwise, docker doesn't know which registry server to upload image to. In other words, tag contains information about the registry server, not an optional thing.

#

4. Delete the images on host. Test the image from the container pull.

Note: delete or upload if there is a version number other than latest, it needs to be attached. The system automatically replenishes latest by default, so the feedback cannot be found after executing the command.

[root@master docker] # docker rmi 172.17.0.1:5000/hello-world

Error: No such image: 172.17.0.1:5000/hello-world

[root@master docker] # docker rmi 172.17.0.1:5000/hello-world:v1

Untagged: 172.17.0.1:5000/hello-world:v1

Untagged: 172.17.0.1:5000/hello-world@sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a

[root@master docker] #

[root@master docker] # docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

Mariadb latest 3a2ef06682ac 9 hours ago 356MB

Wordpress latest a541a1a59631 2 days ago 447MB

Busybox latest e4db68de4ff2 2 weeks ago 1.22MB

Registry.aliyuncs.com/google_containers/kube-proxy v1.14.0 5cd54e388aba 3 months ago 82.1MB

Registry.cn-beijing.aliyuncs.com/imcto/flannel v0.11.0-amd64 03ad33ab3dd7 3 months ago 52.6MB

Registry latest f32a97de94e1 3 months ago 25.8MB

[root@master docker] #

[root@master docker] # docker pull 172.17.0.1:5000/hello-world

Using default tag: latest

Error response from daemon: manifest for 172.17.0.1:5000/hello-world:latest not found

[root@master docker] # docker pull 172.17.0.1:5000/hello-world:v1

V1: Pulling from hello-world

1b930d010525: Pull complete

Digest: sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a

Status: Downloaded newer image for 172.17.0.1:5000/hello-world:v1

[root@master docker] #

[root@master docker] # docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

Mariadb latest 3a2ef06682ac 9 hours ago 356MB

Wordpress latest a541a1a59631 2 days ago 447MB

Busybox latest e4db68de4ff2 2 weeks ago 1.22MB

Registry.cn-beijing.aliyuncs.com/imcto/flannel v0.11.0-amd64 03ad33ab3dd7 3 months ago 52.6MB

Registry latest f32a97de94e1 3 months ago 25.8MB

172.17.0.1:5000/hello-world v1 fce289e99eb9 6 months ago 1.84kB

[root@master docker] #

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report