Get Started with Artifactory and Docker V1

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide
ft:sourceType
Paligo

Artifactory supports Docker transparently, meaning you can point the Docker client at Artifactory and issue push, pull and other commands in exactly the same way that you are used to when working directly with a private registry or Docker Hub.

To get started using Docker with Artifactory you need to execute the following steps:

  1. Set up a web server as a reverse proxy

  2. Create a local repository

  3. Set up authentication

  4. Push and pull images

The screencast at the end of this section provides a demonstration.

1. Set up NGINX as a Reverse Proxy for Docker V1

Artifactory can only be used with Docker through a reverse proxy due to the following limitations of the Docker client:

  1. You cannot provide a context path when providing the registry path (e.g localhost:8081/artifactory is not valid)

  2. Docker will only send basic HTTP authentication when working against an HTTPS host

For Artifactory to work with Docker, the preferred web server is NGINX v1.3.9 and above configured as a reverse proxy.

For other supported web servers, please refer to Alternative Proxy Servers.

Below is a sample configuration for NGINX which configures SSL on port 443 to a specific local repository in Artifactory (named docker-local) on a server called artprod.company.com.

Using Docker v1, Docker client v1.10 and Artifactory 4.4.3 known issue.

To avoid incompatibility when using Docker V1 with Docker 1.10, use the NGINX configuration displayed below and not the NGINX configuration generated by Artifactory v4.4.3.

Multiple Docker repositories and port bindings

If you want to use multiple Docker repositories, you need to copy this configuration and bind different ports to each local repository in Artifactory. For details, please refer to Port Bindings.

Repository URL prefix

When accessing a Docker repository through Artifactory, the repository URL must be prefixed with api/docker in the path. For details, please refer to Docker Repository Path and Domain.

2. Create a Local Docker V1 Repository

This is done in the same way as when configuring a local repository to work with Docker V2, however, in the Docker Settings section, you should make sure to select V1 as the Docker API version.

Docker Settings V1.png

Work with Artifactory Cloud For Docker V1

Due to limitations of the Docker client, in Artifactory Cloud there is a special configuration for each server with a sub-domain.

You need to create a new Docker enabled local repository named docker-local.

Then, use the following address when working with the Docker client: "${account_name}.jfrog.io"

3. Set Up Authentication for Docker V1

When using Artifactory with Docker V1, you need to set your credentials manually by adding the following section to your ~/.docker/config.json file.

~/.docker/config.json

{
        "auths" :{
                "https://artprod.company.com" : {
                        "auth": "<USERNAME>:<PASSWORD> (converted to base 64)",
                                "email": "youremail@email.com"
                },
                "https://artdev.company.com" : {
                        "auth": "<USERNAME>:<PASSWORD> (converted to base 64)",
                                "email": "youremail@email.com"
                }
        }
} 

4. Push and Pull Images With Docker V1

Pushing and pulling images when using Docker V1 is done in the same way as when using Docker V2.