The Repository Path Method for Docker

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide
ft:sourceType
Paligo

Getting started with Docker and your self-hosted Artifactory Pro installation using the path method involves four basic steps:

Configuring Artifactory

To configure Artifactory and your reverse proxy using the path method, carry out the following steps:

  1. Make sure Artifactory is up and running, and is activated with a valid license.Installing ArtifactoryArtifactory Comparison Matrix

  2. Create your Virtual Docker Repositories (as well as a local and remote Docker repository that it should aggregate). In our example below we will use a repository named docker-virtual.

  3. Make sure you have a reverse proxy server up and running.

  4. Obtain a valid SSL certificate or use a self-signed certificate. To create a self-signed certificate, you can follow these instructions for Ubuntu.

    Note

    Make sure your certificate matches the Artifactory hostname used in your reverse proxy configuration. In our example below we will use art.local.

Configure your reverse proxy

Artifactory's can generate your complete reverse proxy configuration file for supported servers.

Go to Reverse Proxy Configuration Generator and fill in the fields in according to how your reverse proxy is set up while making sure to:

  1. Use the correct Artifactory hostname in the Reverse Proxy Settings window, configure the Public Server Name field (in our example this will be art.local)

  2. Select Repository Path as the Reverse Proxy Method under Docker Reverse Proxy Settings.

NginxCopy the code snippet generated by the configuration generator into your artifactory-nginx.conf file, and place it in your /etc/nginx/sites-available directory.

Create the following symbolic link.

sudo ln -s /etc/nginx/sites-available/artifactory-nginx.conf /etc/nginx/sites-enabled/artifactory-nginx.conf

Apache HTTPD

Copy the code snippet generated by the configuration generator into your artifactory-apache.conf file and place it in your /etc/apache2/sites-available directory.

Create the following symbolic link:

sudo ln -s /etc/apache2/sites-available/artifactory-apache.conf /etc/apache2/sites-enabled/artifactory-apache.conf
Configure Your Docker Client

To configure your Docker client, carry out the following steps

  1. Add the following to your DNS or to the client's /etc/hosts file:

    <ip-address> art.local 
  2. Since the certificate is self-signed, you need to import it to your Docker certificate trust store as described in the Docker documentation. Alternatively, you can configure the Docker client to work with an insecure registry as described in the Docker documentation.

  3. Restart your Docker daemon/engine to apply the insecure registry flag (if self-signed certificate is imported, you do not need to restart the Docker daemon/engine).

Test Your Setup

To verify your reverse proxy is configured correctly, run the following command making sure that the return code is 200:

curl -I -k -v https://<artifactory url>/api/system/ping

Run the following commands to ensure your proxy configuration is functional and can communicate with Artifactory:

  • Pull the "hello-world" image

    docker pull hello-world
  • Login to repository docker-virtual

    docker login art.local
  • Tag the "hello-world" image

    docker tag hello-world art.local/docker-virtual/hello-world
  • Push the tagged "hello-world" image to docker-virtual

    docker push art.local/docker-virtual/hello-world