Using the latest version?
JFrog Container Registry Guide
Getting Started with JFrog Container Registry Cloud
Using Docker repositories with the Cloud Version is quick and easy to use.
Since, with JFrog Container Registry Cloud, you are using JFrog Container Registry as a hosted service, there is no need to configure JFrog Container Registry with a reverse proxy.
The example at the end of this section shows a complete process of creating a Docker repository, logging in, pulling an image and pushing an image.
Using Docker Client with JFrog Container Registry Cloud
To use the Docker client with one of your JFrog Container Registry Cloud Docker repositories, you can use the native Docker client to login to each Docker repository, pull, and push images as shown in the following example:
Login to your repository use the following command with your JFrog Container Registry Cloud credentials.
docker login ${server-name}-{repo-name}.jfrog.io
Pull an image using the following command
docker pull ${server-name}-{repo-name}.jfrog.io/<image name>
To push an image, first tag it and then use the push command
docker tag <image name> ${server-name}-{repo-name}.jfrog.io/<image name> docker push ${server-name}-{repo-name}.jfrog.io/<image name>
Test Your Setup
You can test your setup with this example that assumes you are using an JFrog Container Registry Cloud server named "acme".
The scenario it demonstrates is:
- Pulling the "hello-world" Docker image
- Logging into your virtual Docker repository
- Retagging the "hello-world" image, and then pushing it into your virtual Docker repository
Start by creating a virtual Docker repository called dockerv2-virtual
.
Pull the "hello-world" image
docker pull hello-world
Login to repository dockerv2-virtual
docker login acme-dockerv2-virtual.jfrog.io
Tag the "hello-world" image
docker tag hello-world acme-dockerv2-virtual.jfrog.io/hello-world
Push the tagged "hello-world" image to dockerv2-virtual
docker push acme-dockerv2-virtual.jfrog.io/hello-world
Getting Started with JFrog Container Registry On-Prem
The Docker client has the following two limitations:
- You cannot use a context path when providing the registry path (e.g
localhost:8081/artifactory
is not valid) - Docker will only send basic HTTP authentication when working against an HTTPS host
JFrog Container Registry offers solutions to these limitations allowing you to create and use any number of Docker registries.
- Using a reverse proxy
When used, a reverse proxy, maps Docker commands to one of the multiple Docker registries in JFrog Container Registry - Without a reverse proxy
JFrog Container Registry supports using Docker without the use of a reverse proxy allowing you to create and use multiple Docker registries in JFrog Container Registry out-of-the-box.
Using a Reverse Proxy
Testing or evaluating?
If you are currently only testing or evaluating using JFrog Container Registry with Docker, we recommend running JFrog Container Registry as a Docker container which is easily installed and comes with a proxy server and Docker registries pre-configured out-of-the-box. You can be up and running in minutes.
With the ports method, a port number is mapped to each JFrog Container Registry Docker registry. While this is an easy way to get started, you will need to modify your reverse proxy configuration and add a new mapping for each new Docker registry you define in JFrog Container Registry. In addition, firewalls and other restrictions by your IT department may restrict port numbers making the ports method not feasible.
With the subdomain method, you only need to configure your reverse proxy once, and from then on, the mapping from Docker commands to Docker registries in JFrog Container Registry is dynamic and requires no further modification of your reverse proxy configuration.
We recommend to use the subdomain method since it will require one time effort.
The Subdomain Method
Getting started with Docker and your on-prem JFrog Container Registry installation using the subdomain method involves four basic steps:
Configuring JFrog Container Registry
To configure JFrog Container Registry and your reverse proxy using the subdomain method, carry out the following steps:
- Make sure JFrog Container Registry is up and running.
- Create your virtual Docker repository (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.
- Make sure you have a reverse proxy server up and running.
Configuring your reverse proxy
JFrog Container Registry'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:
- Use the correct JFrog Container Registry hostname in the Public Server Name field (in our example this will be art.local).
- Select Subdomain as the Reverse Proxy Method under Docker Reverse Proxy Settings.
NGINX
Copy 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 you /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
Configuring Your Docker Client
To configure your Docker client, carry out the following steps
Add the following to your DNS or to the client's
/etc/hosts
file:<ip-address> docker-virtual.art.local
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.
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 JFrog Container Registry:
Pull the "hello-world" image
docker pull hello-world
Login to repository docker-virtual
docker login docker-virtual.art.local
Tag the "hello-world" image
docker tag hello-world docker-virtual.art.local/hello-world
Push the tagged "hello-world" image to docker-virtual
docker push docker-virtual.art.local/hello-world
The Ports Method
Getting started with Docker and your on-prem JFrog Container Registry installation using the ports method involves two basic steps:
Configuring JFrog Container Registry and Your Reverse Proxy
To configure JFrog Container Registry and your reverse proxy using the ports method, carry out the following steps:
- Make sure JFrog Container Registry is up and running.
- Create your virtual Docker repository (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.
- Make sure you have a reverse proxy server up and running.
Obtain an SSL certificate or use a Self-Signed certificate that can be generated following this example.
Make sure your certificate matches the JFrog Container Registry hostname used in your reverse proxy configuration. In our example below we will use art.local.
- Configure your reverse proxy. JFrog Container Registry's Reverse Proxy Configuration Generator can generate your complete reverse proxy configuration file for supported servers. All you need to do is fill in the fields in according to how your reverse proxy is set up while making sure to:
- Use the correct JFrog Container Registry hostname in the Public Server Name field
- Select Ports as the Reverse Proxy Method under Docker Reverse Proxy Settings. In the example below, we will use port 5001 to bind repository docker-virtual.
NGINX
For JFrog Container Registry to work with Docker, the preferred web server is NGINX v1.3.9 and above.
First, you need to create a self-signed certificate for NGINX as described here for Ubuntu.
Then use JFrog Container Registry's Reverse Proxy Configuration Generator to generate the configuration code snippet for you.
Copy the code snippet into yourartifactory-nginx.conf
file and place it in your/etc/nginx/sites-available
directory.
Finally, create the following symbolic link:sudo ln -s /etc/nginx/sites-available/artifactory-nginx.conf /etc/nginx/sites-enabled/artifactory-nginx.conf
Apache HTTPDInstall Apache HTTP server as a reverse proxy and then install the required modules.
Create the following symbolic link:
sudo ln -s /etc/apache2/mods-available/slotmem_shm.load /etc/apache2/mods-enabled/slotmem_shm.load
Similarly, create corresponding symbolic links for:
- headers
- proxy_balancer
- proxy_load
- proxy_http
- proxy_connect
- proxy_html
- rewrite.load
- ssl.load
- lbmethod_byrequests.load
Then use JFrog Container Registry's Reverse Proxy Configuration Generator to generate the configuration code snippet for you.
Copy the code snippet into yourartifactory.conf
file and place it in your/etc/apache2/sites-available
directory.HAProxy
First, you need to create a self-signed certificate for HAProxy as described here for Ubuntu.Then, copy the code snippet below into your
/etc/haproxy/haproxy.cfg
file. After editing the file as described in the snippet, you can test your configuration using the following command:haproxy -f /etc/haproxy/haproxy.cfg -c
Configuring Your Docker Client
To configure your Docker client, carry out the following steps
Add the following to your DNS or to the client's
/etc/hosts
file:<ip-address> art.local
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 by adding the following line to your
/etc/default/docker
file (you may need to create the file if it does not already exist):DOCKER_OPTS="$DOCKER_OPTS --insecure-registry art.local:5001"
Restart your Docker engine.
Test Your Setup
To verify your reverse proxy is configured correctly, run the following command:
// Make sure the following results in return code 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 JFrog Container Registry. In this example, we will pull down a Docker image, tag it and then deploy it to our our docker-virtual repository that is bound to port 5001:
// Pull the "hello-world" image docker pull hello-world // Login to repository docker-virtual docker login art-local:5001 // Tag the "hello-world" image docker tag hello-world art-local:5001/hello-world // Push the tagged "hello-world" image to docker-virtual docker push art-local:5001/hello-world
Testing With a Self-signed Certificate
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.
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).
Running$docker info
will list the Insecure registries that have been applied under the Insecure Registries entry.- Use the steps above to interact with the JFrog Container Registry Docker Registry
Without a Reverse Proxy
JFrog Container Registry introduces a new method referred to as the "Repository Path" method since it uses the the Docker repository path prefix (<REPOSITORY_KEY/IMAGE>) to access a specific JFrog Container Registry Docker registry from the Docker client. Note that you may still have a reverse proxy configured for JFrog Container Registry for other reasons, however when configured to use Repository Path method, requests to Docker registries in JFrog Container Registry will be handled by JFrog Container Registry's embedded Tomcat instead of the reverse proxy.
Docker API v2 required
You can only use the Repository Path method with JFrog Container Registry Docker registries configured for Docker API v2.
Sub-domain method is recommended for production
Configuring JFrog Container Registry
To configure JFrog Container Registry to use the Repository Path method, carry out the following steps:
Make sure JFrog Container Registry is up and running.
- Create your virtual Docker repository (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.
Go to the HTTP Settings screen from the Admin module under Configuration | HTTP Settings.
In the Docker Settings panel, select Repository Path as the Docker Access Method.
In the Reverse Proxy Settings panel select Embedded Tomcat as the Server Provider (which indicates you're not using a reverse proxy).You must use Embedded Tomcat
You can only use JFrog Container Registry as a Docker registry without a reverse proxy by using the internal embedded Tomcat
Configuring Your Docker Client
Using the Repository Path method, you can work with JFrog Container Registry as a Docker registry without a reverse proxy on an insecure connection (i.e. only HTTP is supported, not HTTPS). You need to configure the Docker client to work with an insecure registry as described in the Docker documentation.
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). Running $docker info
will list the Insecure registries that have been applied under the Insecure Registries entry.
Test Your Setup
Don't use localhost or 127.0.0.1 or "/artifactory"
Due to a limitation in the Docker client, you cannot access an JFrog Container Registry Docker registry as localhost or 127.0.0.1. If you need to access a local installation of JFrog Container Registry, make sure to specify its full IP address.
In addition, when specifying JFrog Container Registry's URL, you should omit the "/artifactory" suffix normally used.
For example, if your local machine's IP address is 10.1.16.114, then you must specify your JFrog Container Registry URL as http://
10.1.16.114:8081
(using http://localhost
:8081
will not work).
The code snippets below assume you have a virtual Docker repository named docker-virtual
in an JFrog Container Registry installation at IP 10.1.16.114.
First, you should verify that your Docker client can access JFrog Container Registry by run the following command. Making sure that the return code is 200:
curl -I -k -v http://10.1.16.114:8081/artifactory/api/system/ping
Now you can proceed to test your Docker registry.
Login to JFrog Container Registry as your Docker registry
docker login -u admin -p password 10.1.16.114:8081
Pull the "hello-world" image from the
docker-virtual
repositorydocker pull 10.1.16.114:8081/docker-virtual/hello-world:latest
Tag a Docker image
docker tag 10.1.16.114:8081/docker-virtual/hello-world:latest 10.1.16.114:8081/docker-virtual/<tag_name>
Push the tagged image to
docker-virtual
docker push 10.1.16.114:8081/docker-virtual/<tag_name>