docker series - setting up a local registry of all kinds of container pit

Summary pit:
A concern daemon.json writing format. Several points may be the wrong word.
b.tag to clearly indicate the information registry server to push uploaded successfully. Not optional information.
c.tag in the version number to be clearly written on. The system auto-complete is to use latest.

####################################################################

Building process:
the premise: by docker pull registry download a registry

1. The new /etc/docker/daemon.json
[the root @ Master Docker] daemon.json CAT #
{
"in the insecure-Registries": [ "172.17.0.1:5000"]
}
below this error, because the new / etc / docker / daemon.json file has not been successful.
[root @ Master ~] # Docker the Push 172.17.0.1:5000/hello-world
at The Repository the Push the Refers to [172.17.0.1:5000/hello-world]
the Get https://172.17.0.1:5000/v2/ : HTTP: server gave HTTP response to HTTPS client

Error-prone four places:
. A Registry Error-written in the insecure.
B wrong written. Http://172.17.0.1:5000
C with the wrong container 172.17.0.2 of the IP.
D docker forget to restart service.
## ################################################## #####################

2. Local is set up successfully registry, you can view the info by Docker
[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 local registry container, push upload the image to the local registry container
mkdir -p / data / registry
on ## host create a directory to store container volume do
docker run -d -p 5000: 5000 -v / data / registry: / var / lib / Registry Registry --name local_registry
## starting container with the external port 5000, 5000 is the first host port, a second container port 5000 is
[root @ Master Docker] # Docker PS | grep -i local_registry
b4c6b769aabc registry "/entrypoint.sh / etc ..." Up the About AN hour 30 minutes ago Member 0.0.0.0:5000->5000/tcp local_registry
## checks whether to activate the registry container

[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 absolutely necessary to the correct tag, which is tag must clearly indicate clearly which registry.
Otherwise, docker do not know if you want to upload the image to which the registry server. That tag contains information about the registry server, not an optional thing.

##########################################################################

4. Delete some images on the host. Pull down test image from the container.
Note: If you delete or upload a version number is not the latest, the need for additional on. The default is automatic replenishment latest, after this feedback can not find execute 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]#

Guess you like

Origin blog.51cto.com/jsahz/2417236