Push\Pull docker images to Artifactory

12.3k views Asked by At

I'm trying to push docker images to artifactory as part of a CI jenkins job. I have an Artifactory installed with url art:8080 I installed Docker on Win2016 and built my dockerfile.

Now I stuck in how to push the output image of the dockerfile. I tried:

<!-- language: lang-none -->

docker tag microsoft/windowsservercore art:8080/imageID:latest
docker push art:8080/docker-local:latest

but I get an error stating:

Get https://art:8080/v2/: dial tcp: lookup artifactory: getaddrinfow: No such host is known.

Where is the https getting from? How do I push to the correct local docker repo in my artifactory?

2

There are 2 answers

7
PolarisUser On BEST ANSWER

Docker requires you to use https. What I do (I use Nexus not Artifactory) is setup a reverse proxy using nginx. Here is the doc for that - https://www.jfrog.com/confluence/display/RTF/Configuring+a+Reverse+Proxy

Alternatively, you can set Docker to not require https (though not recommended)

0
Jose Luis Soto Posada On

Since you're asking how to pull, these steps worked for an enterprise artifactory where Certificate CA are not trusted outside the organization

$ sudo mkdir -p /etc/docker/certs.d/docker-<artifactory-resolverhost>
$ sudo cp /tmp/ca.crt /etc/docker/certs.d/docker-<artifactory-resolverhost>
$ sudo chown root:docker /etc/docker/certs.d/docker-<artifactory-resolverhost>/ca.crt
$ sudo chmod 740 /etc/docker/certs.d/docker-<artifactory-resolverhost>/ca.crt

Where ca.crt is the base-64 chain of CA trusted certificates and is the resolver hostname of the repository. For ex. repo.jfrog.org if you were using the public repository. To confirm you can do a ping against "artifactory-resolverhost" to make sure is reachable from your network

Then you should be able to pull an image with your user belonging to docker group for ex.

docker pull docker-<artifactory-resolverhost>/<repository-name>/rhel7-tomcat:8.0.18_4

You can then view the downloaded image with below command

docker images