Can't push docker built image to SSL artifactory - docker

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).

Related

Need docker registry URL for mcr.microsoft.com

In our org, we have to use Nexus as proxy for downloading docker images from internet as our servers won't have internet connectivity.
I've setup proxy for Docker hub registry using URL ""
I want to setup proxy for the new MCR (mcr.microsft.com) registry.
Can someone please tell me what registry URL should i configure in my proxy server to be able to pull images from mcr through proxy...
instead of below command,
docker pull mcr.microsoft.com/dotnet/core/sdk
I want to be able to use
docker pull <IP_Of_Nexus_Proxy>:<Port_Of_Proxy>/dotnet/core/sdk
Below is working for me and pull image from docker hub
docker pull <IP_Of_Nexus_Proxy>:<Port_Of_Proxy>/hello-world

Can't push/pull from local docker registry

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.

Unable to login to private docker registry from Jenkins

I am trying to use Jenkins to build and push docker images to private registry. However, while trying docker login command, I am getting this error:
http: server gave HTTP response to HTTPS client
I know that this might be happening because the private registry is not added as an insecure registry. But, how I can resolve this in CI pipeline?
Jenkins is set up on a Kubernetes cluster and I am trying to automate the deployment of an application on the cluster.
This has nothing to do with the Jenkins CI pipeline or Kubernetes. Jenkins will not be able to push your images until configure follow either of the below steps
You have two options here
1) Configure your docker client to use the secure registry over HTTPS. This will include setting up self signed certificates or getting certificates from your local certificate authority.
2) Second solution is to use your registry over an unencrypted HTTP connection.
So if you are running docker on kubernetes. You will have to configure the daemon.json file in /etc/docker/daemon.json.
PS: This file might not exist. You will have to create it.
Then add in the below content. Make sure you change the url to match your docker registry
{
"insecure-registries" : ["myregistrydomain.com:5000"]
}
Then restart docker using systemctl restart docker or etc/init.d/docker restart depending on the version of linux distro installed on your cluster
Let me know if you have any questions

Does docker client support context path for registry?

Sonatype Nexus documentation indicates that you can push to a docker registry without a HTTP connector as per this guide.
It states the following:
Nexus would be listening at a non-https connector such as the default
8081. Docker repositories are added into Nexus as normal but would NOT be configured with any connector port values.
And the example shows:
The reverse proxy would direct docker push commands received at
https://project.example.com:8086 to
http://locahost:8081/repository/docker-hosted-project
I'm failing to understand how http://locahost:8081/repository/docker-
hosted-project resolves to a registry. I can't test this directly on the Nexus server since the docker client does not support context paths.
How is this supposed to work?

artifactory as docker registry

I tried to set up artifactory as docker registry as shown in this video: http://www.jfrog.com/video/artifactory-docker-integration/
However, I don't have SSL installed in artifactory so I'm using the --insecure-registry flag. (as shown in error in docker build publish plugin and Remote access to a private docker-registry)
Anyway, I don't know how to figure out the artifactory as docker registry url so I can do this:
curl -k -uusername:password "http://sdpvvrwm812.ib.tor.company.com:8081/artifactory/api/docker/docker-images"
This page, http://www.jfrog.com/confluence/display/RTF/Docker+Repositories, shows at the bottom that something called a reverse proxy might be needed? Is this true and if so how do I install such a thing?
The reason behind requiring a reverse proxy in front of Artifactory is related to a Docker client limitation - you cannot use a context path when providing the registry path, e.g sdpvvrwm812.ib.tor.company.com:8081/artifactory/api/docker/docker-images is not valid.The Docker client assumes you are working with one big registry for all images, while Artifactory allows you to manage multiple registries (repositories) on the same server.
To overcome this issue you should setup a reverse proxy which will allow the Docker client to send requests to the root context and forward those requests to the correct repository path in Artifactory. For example, forwarding requests from sdpvvrwm812.ib.tor.company.com:8888/ to sdpvvrwm812.ib.tor.company.com:8081/artifactory/api/docker/docker-images
The Artifactory documentation contains configuration examples for NginX, Apache and HAProxy.
Notice that there are different configurations for Docker registry API v1 and v2.
After setting up the reverse proxy, the Docker client should use the proxy in order to access Artifactory.
If you are using the --insecure-registry flag there is no need to configure an SSL certificate. With older versions of Docker, before this flag was introduced (Docker 1.3.2) it was a mandatory requirement.

Resources