Can't push/pull from local docker registry - docker

I have created a cluster of Kubernetes, and installed docker for each node.
When I try to pull or push an image to my local registry, using docker push local_registry_addr:port/image_id, I get the following response: Get local_registry_addr:port/v2: http: server gave HTTP response to HTTPS client.
This happens although I got the certificate from the registry server, and add it as a certificate on my docker server. If I try to wget local_registry_addr:port, I get 200 OK.
How can I fix it? Is there anything I need to configure perhaps?

The problem was that I wasn't suppose to add the port - using push local_registry_addr/image_id worked fine.

Related

Can't push docker built image to SSL artifactory

Having trouble to push docker to internal Artifactory (6.11.1).
We have Artifactory installed on port 443 with Docker setting Repository Path.
If I login to using artifactory.local.int, pull an image tag it and push it back it works
docker push artifactory.local/repo/image-name
but when I build an image my self or pull directly from docker hub and try to push
docker will try to connect to port 80 and timeout because Artifactory isn't listening to this port.
I also tried to tag an image with the port I get:
docker push artifactory.local:443/repo/image-name
error parsing HTTP 400 response body: invalid character 'B' looking for the beginning of value: "Bad Request\r\nThis combination of host and port requires TLS.\r\n"
Am I missing some port or TLS configuration? why am I able to push pulled images back to artifactory but new images aren't working?
Try:
docker push https://artifactory.local/repo/image-name
You might need to login first:
docker login https://artifactory.local/repo/
In your example the docker client tries accessing Artifactory over port 443, but using http protocol instead of https protocol.
Before you push any image to Artifactory, you have to tag it and for more details click on "Set Me Up button" in Artifactory and select the docker repository it will provide detailed steps.
Docker access method also matters, Artifactory uses 3 methods
1. Repository path
2. Subdomain
3. Port method
You have to perform the steps based on this method which you can setup in HTTP settings in Artifactory.
You can not use HTTPS with Repository Path and without a reverse proxy for Docker - Artifactory integration. If you would like to keep using Repository Path you will need to configure HTTP, and if you want HTTPS you can use either Port method or SubDomain (SubDomain is more recommended).

how to create a Docker local private repository

I created a local docker repository in my server. When I try to push the image into it, there is an error. I need an HTTPS connection. How do I get an HTTPS for my own docker registry?
os: ubuntu 16.x
Docker version: 18.06.1-ce, build e68fc7a
Already Tried:
Adding the below lines into /etc/docker/daemon.json,
{
"insecure-registries" : ["myregistrydomain.com:5000"]
}
Expected: I should be able to push and pull images into my own server containing docker registry
To avoid exposing your registry to the wider internet while still being able to pull images from it you can:
Run a local registry on your dev machine, to which you push images
ssh to your server with a reverse tunnel:
ssh -R 5000:localhost:5000 myhost
(listen on port 5000 of the remote machine (-R 5000) and tunnel back to localhost:5000 on the local machine)
Now, on myhost you can docker pull localhost:5000/someImage, but it's actually seamlessly connecting through an encrypted tunnel back to the registry on your dev machine.
You can have a local unsecured registry.
For that, you need to add an exception in your /etc/docker/daemon.json, this way
{
"insecure-registries" : ["myregistrydomain.com:5000"]
}
The same link shows how to use a self-signed certificate.
Eventually, using an actual certificate is juste a step further, but you may not need one for development purpose.
EDIT :
You need to restart your daemon after that :
service docker restart

Got AuthorizedOnly when pulling images behind corporate proxy

I’ve trying to get docker working behind a corporate proxy. Following the document here:
https://docs.docker.com/config/daemon/systemd/#httphttps-proxy
Basically adding:
[Service]
Environment=“HTTP_PROXY=http://[username]:[password]#127.0.0.1:3128/”
under
/etc/systemd/system/docker.service.d/http-proxy.conf
Restart docker and all.
But when running “docker pull hello-world” or “sudo docker pull hello-world”, got this error:
centos7 ~]$ docker pull hello-world
Using default tag: latest
Trying to pull repository docker. io/library/hello-world …
Pulling repository docker. io/library/hello-world
Error while pulling image: Get https:
/index.docker.io/v1/repositories/library/hello-world/images: AuthorizedOnly
Looks around the web, but couldn’t find any “AuthorizedOnly” error reported before.
docker -v
Docker version 1.12.6, build 3e8e77d/1.12.6
Any hints/help appreciated.
Found the issue: It's not the problem with docker proxy configuration. It was the proxy itself that blocks hub.docker.com.
To resolve this particular problem, I have use a different proxy with less restrictions.
Thanks all!
Double-check your enterprise proxy URL.
Usually, an enterprise proxy does not reside on localhost (127.0.0.1), but on a specific IP address.
Usually, HTTPS_PROXY needs to be set as well (to the same HTTP URL)
Usually, NO_PROXY needs to be set, at least to localhost, to avoid contacting the proxy for every remote query.

Error: Status 404 trying to push repository busybox

I tried to push signed images from a machine (A) to a registry on another machine (B).
docker tag busybox:latest ubuntu:5005/busybox:latest
docker push ubuntu:5005/busybox:latest
The push refers to a repository [ubuntu:5005/busybox] .... Error: Status 404 trying to push repository busybox ... .
telnet ubuntu 5005
Trying 127.0.1.1...
telnet: Unable to connect to remote host: Connection refused
Are there any extra settings in order to push signed images on a diff machine. Or just to push without signing? Thanks a lot!
If you can't reach this, make sure your ports are properly exposed on the machine and that your networking resolves "ubuntu" to your newest machine correctly.
It's probable Machine A has no rule allowing ubuntu to resolve to <machine B>.
Make sure you docker login as well once you verify this, too.
This docs helped me to solve the problem.
https://docs.docker.com/registry/insecure/.
https://docs.docker.com/registry/deploying/#get-a-certificate.
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-docker-registry-on-ubuntu-14-04.

Docker: Issue with pulling from a private registry from another server

I just started learning docker.
I have a private registry running on one server(server1), and can pull a test image from it on server1 by typing the following:
docker pull 127.0.0.1:5000/test
However, when I type the above command from another server, I get the error message below:
Error: Invalid Registry endpoint: Get http://127.0.0.1:5000/v1/_ping: dial tcp 127.0.0.1:5000: connection refused
Am I missing something in configuration?
Any help is appreciated.
Thanks!
The IP 127.0.0.1 refers always to the local machine. So when you call 'docker pull 127.0.0.1:5000/test' from another machine, you must use the real IP of the server, not 127.0.0.1.
Maybe try to ping the Server first by calling http://XXXXXXX:5000/v1/_ping from the other machine to make sure it is available and you use the correct IP.
Docker 1.3 added '--insecure-registry' parameter which allows you to pull from a remote private registry. Refer this: Setting up a remote private Docker registry

Resources