Artifactory Docker Subdomain Access Configuration Guide

Configure the Docker subdomain access method for a local Docker repository on JFrog Artifactory deployed with Helm on Kubernetes.

This page shows how to set up JFrog Artifactory (deployed with Helm on Kubernetes) so that a local Docker repository uses the Subdomain access method. You can then push and pull Docker images with a URL in this format:

http://<reponame>.artifactory

Prerequisites

You need:

  • Artifactory installed with Helm on a Kubernetes cluster.
  • kubectl set up to use the correct cluster.
  • Docker Desktop installed on your local machine.
  • Admin access to the Artifactory UI.
  • Access to /etc/hosts on your local machine, or to a DNS server.

Step 1: Verify the Artifactory Helm Installation

Before you continue, confirm that Artifactory was deployed on your Kubernetes cluster with the Helm installation type.

Step 2: Retrieve the Default Nginx Configuration

Get the default Nginx ConfigMap and read it:

kubectl get cm artifactory-nginx-artifactory-conf -o yaml -n <namespace>

Replace <namespace> with your actual namespace (for example, artifactory).

Step 3: Validate the Nginx server_name and Rewrite Rules

Check that the Nginx configuration has the two entries below, written exactly as shown.

The required server_name entry:

server_name ~(?<repo>.+)\.artifactory artifactory;

The required rewrite rule:

if ( $repo != "" ) {
  rewrite ^/(v1|v2)/(.+) /artifactory/api/docker/$repo/$1/$2 break;
}

Step 4: Set the Docker Access Method to Subdomain in the UI

  1. Go to Administration > Artifactory Settings > HTTP Settings.
  2. Open the Docker Access Method list.
  3. Select Sub Domain.
  4. Select Save.

Step 5: Create a Local Docker Repository

  1. Go to Administration > Repositories > Add Repositories > Local Repository.
  2. Select Docker as the package type.
  3. Enter a repository key name (for example, docker-sub).
  4. Select Save & Finish.

The repository key becomes the subdomain prefix in your Docker URLs.

Step 6: Update /etc/hosts on Your Local Machine

Open the hosts file:

sudo vi /etc/hosts

Add the following line:

<external IP> <reponame>.artifactory

The Nginx server_name uses the pattern ~(?<repo>.+)\.artifactory artifactory;. This pattern takes everything before .artifactory as the repository name. The Docker API rewrite rule then uses that name.

Step 7: Configure Docker Desktop Insecure Registries

Open Docker Desktop, go to Settings > Docker Engine, and update the JSON configuration to match this:

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "insecure-registries": [
    "test.jfrog-artifactory",
    "test.jfrog-artifactory:443",
    "docker-local.art.local",
    "docker-sub.artifactory"
  ]
}

Step 8: Log In to Docker Through the Subdomain URL

Log in with your user name and password:

docker login -u <username> -p "<password>" <reponame>.artifactory

Step 9: Access and Use the Repository

To open the repository in a browser, go to:

http://<reponame>.artifactory

Did this page help you?