Bobcares

Artifactory Docker Setup | How To?

by | Jun 25, 2023

Artifactory Docker setup is possible in 2 ways namely, Artifactory Cloud and Artifactory Self-hosted. At Bobcares, with our Docker Hosting Support Service, we can handle your Docker Artifactory issues.

Artifactory-Docker Setup

We can use Docker with Artifactory as Artifactory Cloud or Artifactory Self-hosted. In Artifactory Cloud, we don’t need to set up a reverse proxy because Artifactory is a hosted service, so we can create the Docker repositories and begin pushing and pulling Docker images. In Artifactory Self-hosted, we need to setup the self-hosted installation of Artifactory Pro to work with Docker. The Docker client requires a different hostname for each registry. Artifactory supports this whether we are using a reverse proxy or not.

How To Setup Artifactory Cloud On Docker?

To use the Docker client with one of our Artifactory Cloud Docker repositories, we can use the native Docker client to login to each Docker repository, pull, and push images.

  1. Firstly, use the Artifactory Cloud credentials to log into the repository using the command below.
    docker login ${server-name}.jfrog.io

     

  2. Secondly, pull an image using the following command.
    docker pull ${server-name}.jfrog.io/{repo-name}/<image name>

     

  3. Thirdly, push an image by first tagging it and then using the push command.
    docker tag <image name> ${server-name}.jfrog.io/{repo-name}/<image name>

    docker push ${server-name}.jfrog.io/{repo-name}/<image name>

     

The setup is complete. Now we have to test the setup.

How To Test Artifactory Cloud-Docker Setup?

Let’s verify the setup through an example.

  1. Firstly, start by creating a virtual Docker repository called dockerv2-virtual.
  2. Then pull the hello-world image using the command:
    docker pull hello-world

     

  3. Now log in to repository dockerv2-virtual using the command:
    docker login acme-dockerv2-virtual.jfrog.io

     

  4. Then tag the hello-world image with the command:
    docker tag hello-world acme-dockerv2-virtual.jfrog.io/hello-world

     

  5. Finally, push the tagged hello-world image to dockerv2-virtual by running the command:
    docker push acme-dockerv2-virtual.jfrog.io/hello-world

     

How To Setup Artifactory Pro On-Prem On Docker?

There are two restrictions on the Docker client. Docker will only send basic HTTP authentication when working against an HTTPS host or when using the insecure registry flag. We cannot use a context path when providing the registry path. However, Artifactory provide 2 solutions for this restrictions.

  • With Reverse Proxy:A reverse proxy maps Docker commands to one of the multiple Docker registries in Artifactory using either the subdomain method, ports method or repository path method. A port number is assigned to each Artifactory Docker registry using the ports method. This is a simple way to get started, but for each new Docker registry we define in Artifactory, we will need to change the reverse proxy configuration and add a new mapping. Additionally, port numbers may be restricted by firewalls and other IT department restrictions, rendering the ports method useless.

    The mapping from Docker commands to Docker registries in Artifactory is dynamic and requires no further modification with the subdomain method because we only need to configure the reverse proxy once.

    The repository path method enables access to numerous repositories from a single point of entry (URL). To achieve this, the name of the repository being accessed is embedded in the image path.on.

  • Without Reverse Proxy: From the release of version 5.8, Artifactory already supports the use of Docker without the need for a reverse proxy, enabling the creation and instantiation of multiple Docker registries. As a result of using the Docker repository path prefix (<REPOSITORY_KEY/IMAGE>) to access a specific Artifactory Docker registry from the Docker client, Artifactory introduces a new method known as the “Repository Path” method. There are reverse proxy configured for Artifactory for other reasons, however when configured to use Repository Path method, requests to Docker registries in Artifactory will be handled by Artifactory’s embedded Tomcat instead of the reverse proxy.

[Looking for a solution to another query? We are just a click away.]

Conclusion

In conclusion, we have seen two methods from our Tech team for the Artifactory Docker setup.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.