pull image from remote registry - docker
Asked Answered
E

3

6

I have installed docker 1.11.2, I am trying to make one private registry for our office.

I followed this link to make private registry, I have successfully pull from localhost but I stuck trying to pull from remote machine.

Short Description of what I have done

Step1 :

docker run -d -p 5000:5000 --restart=always --name registry registry:2

step2:

[root@raj raj]# docker images
REPOSITORY          TAG                 IMAGE ID                   CREATED             SIZE
hello-world         latest              c54a2cc56cbb        11 days ago         1.848 kB
registry            2                   8ff6a4aae657        4 weeks ago         171.5 MB

step3: (for localhost)

[root@raj raj]# docker tag hello-world localhost:5000/hello-world

[root@raj raj]# docker push localhost:5000/hello-world
The push refers to a repository [localhost:5000/hello-world]
a02596fdd012: Pushed 
latest: digest: sha256:a18ed77532f6d6781500db650194e0f9396ba5f05f8b50d4046b294ae5f83aa4 size: 524

step4:

[root@raj raj]# docker pull localhost:5000/hello-world
Using default tag: latest
latest: Pulling from hello-world

Digest: sha256:a18ed77532f6d6781500db650194e0f9396ba5f05f8b50d4046b294ae5f83aa4
Status: Image is up to date for localhost:5000/hello-world:latest

It is working fine

I am trying to pull the image from private registry from remote machine so I have altered the step 3 like below

step3:

[root@raj raj]# docker tag hello-world 192.168.1.23:5000/hello-world

[root@raj raj]# docker push 192.168.1.23:5000/hello-world
The push refers to a repository [192.168.1.23:5000/hello-world]
Get https://192.168.1.23:5000/v1/_ping: tls: oversized record received with length 20527

but it throws error tls:oversized

I have some links related to this issue link1, link2 but it does not resolve my problem

I have some doubt about this link

1) I could not found any docker file in that location /etc/sysconfig/docker, /etc/default/docker for changing –insecure-registry

2) docker -d --insecure-registry 10.11.12.0:5000 (this command is not working it throws below error.

[root@raj raj]# docker -d --insecure-registry 192.168.1.23:5000
flag provided but not defined: -d
See 'docker –help'.

Please help to get pull request from remote machine to private registry.

Emelyemelyne answered 13/7, 2016 at 11:23 Comment(0)
E
7

Follow the sequence of docker command for making private registry

Server Side

docker daemon --insecure-registry server-ip:5000
docker run -d -p 5000:5000 --restart=always --name registry registry:2
docker tag hello-world server-ip:5000/hello-world
docker push server-ip:5000/hello-world

Client side

docker daemon --insecure-registry server-ip:5000
docker pull server-ip:5000/hello-world

Now you can pull/push from your remote repositories, for more detail of registry you can use this command docker inspect registry it will show where the images get store and more info.

Emelyemelyne answered 13/7, 2016 at 12:47 Comment(1)
docker daemon --insecure-registry server-ip:5000 -not working, its saying unknown flag: --insecure-registry @bilalVowell
D
2

Update docker config to add "--insecure-registry", usually the file is located in /etc/default/docker, if you use docker-machine the file is located in /var/lib/boot2docker/profile

Dejection answered 13/7, 2016 at 11:49 Comment(8)
in my case /var/lib/docker folder only present, I followed installation from docs.docker.com/engine/installation/linux/fedora (install with dnf)Emelyemelyne
in that case, just do a simple search to find where the file is located "find / -name "docker" "Dejection
I tried this " find / -type f -name "docker" " it list 1) /usr/share/bash-completion/completions/docker, 2)/usr/bin/docker second one size is 30mb, gedit get crash while open, it seems like shell scriptEmelyemelyne
if you know anyother way to solve this issue please mentionEmelyemelyne
which version of os do you use ?Dejection
4.0.4-301.fc22.x86_64 (fedora 22), I have posted answer please review this, take a look at my note part in that answerEmelyemelyne
try to find "docker.service" fileDejection
BTW, -d is not valid to start Docker daemon anymore. It is docker daemonGoldeye
P
0

In the latest docker version you get unknown flag: --insecure-registry error, do the following:

Edit deamon.json file:

{
    "insecure-registries" : [ "server-ip:5000" ]
}

deamon.json file can found in the following path:

Windows: %userprofile%\.docker\daemon.json

Linux: /etc/docker/daemon.json

Restart docker after updating the deamon.json file

Then do the following:

docker run -d -p 5000:5000 --restart=always --name registry registry:2
docker tag hello-world server-ip:5000/hello-world
docker push server-ip:5000/hello-world

Check the newly added image info

http://server-ip:5050/v2/_catalog
Peroneus answered 2/3, 2022 at 4:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.