Connect Docker CLI to Artifactory

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

You can configure the Docker CLI to work with Artifactory using two methods:

Logged in vs. Anonymous User: You can work with Docker and Artifactory as either a logged in user, or as an anonymous user without logging in. To work with Artifactory using Anonymous Access, configure that access under Admin | Security | General. For details, refer to Allow Anonymous Access.

Connect Docker to Artifactory using docker login

Run the following command:

docker login [JFrogPlatformURL] 

Where:

  • [JFrogPlatformURL]: The URL of your JPD, without the protocol schema

For example:

docker login company.jfrog.io

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.

Connect Docker to Artifactory by Manually Setting Credentials

You can manually set your Docker credentials to authenticate in automated workflows, or if you are using Docker V1. For more information, see Use Docker V1.

Tip

You can copy your authentication snippet from Set Me Up, or you can retrieve credentials directly from Artifactory by running this command:

$ curl -u<USERNAME>:<PASSWORD> "https://[JFrogPlatformURL]/artifactory/api/docker/<REPO_NAME>/<V1|V2>/auth"

Where:

  • <USERNAME>: Your Artifactory username

  • <PASSWORD>: Your Artifactory password

  • [JFrogPlatformURL]: The URL of your JPD

  • <REPO_NAME>: The name of the target repository

  • <V1|V2>: The version of Docker you are using, either V1 or V2.

To manually set Docker credentials:

Add the following snippet to your ~/.docker/config.json file:

{
	"auths": {
		"https://[JFrogPlatformURL]" : {
			"auth": "<TOKEN>",
			"email": "<EMAIL>"
		}
	}
}

Where:

  • [JFrogPlatformURL]: The URL of your JPD

  • <TOKEN>: Your Base64-encoded Artifactory username and password

  • <EMAIL>: The email address associated with your Artifactory account

For example:

{
	"auths": {
		"https://company.jfrog.io" : {
			"auth": "YWRtaW46QVA1N05OaHZTMnM5Qk02RkR5RjNBVmF4TVFl",
			"email": "jeffry@frog.com"
		}
	}
}

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.

Next steps: