Have a question? Want to report an issue? Contact JFrog support

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Artifactory Docker images can be pulled from Bintray and run as a Docker container.

 To do this, you need to have Docker client properly installed and configured on your machine. For details about installing and using Docker, please refer to the Docker documentation.

Note
titleRunning with Docker for Artifactory 4.x

Artifactory as a Docker container has been completely redesigned in version 5.0. If you are running previous versions of Artifactory, please refer to Running with Docker in the Artifactory 4.x User Guide

Tip
titleDocker Compose

The way we recommend running Artifactory on Docker is to orchestrate your setup using Docker Compose. This will ensure you have all the required services specified in a single YAML file with pre-configured parameters.

 


Using Docker Compose

To setup an Artifactory environment made of multiple containers (for example, a database, an Nginx load balancer and Artifactory each running in a different container), you can use docker-compose.

For more details on Docker Compose, please refer to the 

Newtablink
TextDocker documentation
URLhttps://docs.docker.com/compose/
.

Artifactory OSSArtifactory Pro and Artifactory HA can all be run using Docker Compose. For detailed documentation and sample Compose files showing a variety of ways to setup Artifactory with Docker Compose, please refer to the 

Newtablink
Textartifactory-docker-examples
URLhttps://github.com/JFrogDev/artifactory-docker-examples
 repository on GitHub.

Info
iconfalse
titlePage contents

Table of Contents
maxLevel4
minLevel2

Info
iconfalse
titleRead more

Children Display


Artifactory on Docker

Running Artifactory as a container is simple and straightforward, and involves the following basic steps:

Since the Artifactory instance running in a Docker container is mutable, all data and configuration files will be lost once the container is removed. If you want your data to persist (for example when upgrading to a new version), you should also follow the next step.

Pulling the Artifactory Docker Image

The Artifactory Docker image may be pulled from Bintray by executing the corresponding Docker command below depending on whether you are pulling Artifactory OSS or Artifactory Pro:

Code Block
titlePulling the Artifactory Pro Docker Image
docker pull docker.bintray.io/jfrog/artifactory-pro:latest

or

Code Block
titlePulling the Artifactory OSS Docker Image
docker pull docker.bintray.io/jfrog/artifactory-oss:latest

Running an Artifactory Container

You can list the Docker images you have downloaded using the docker images command, which should display something like the following output:

Code Block
$ docker images
 
REPOSITORY                                 TAG                 IMAGE ID            CREATED             SIZE
docker.bintray.io/jfrog/artifactory-pro    latest 		       da70b82904e7        2 days ago          861.5 MB
...

To start an Artifactory container, use:

Code Block
languagebash
$ docker run --name artifactory -d -p 8081:8081 docker.bintray.io/jfrog/artifactory-pro:latest    

Managing Data Persistence

For your data and configuration to remain once the Artifactory Docker container is removed, you need to store them on an external volume mounted to the Docker container. There are two ways to do this:

  • Using Host Directories
  • Using a Docker Named Volume

Using Host Directories

The external volume is a directory in your host's file system (such as /var/opt/jfrog/artifactory). When you pass this to the docker run command, the Artifactory process will use it to read configurationand configuration and store its data.

To mount the above example, you would use the following command:

Code Block
languagebash
$ docker run --name artifactory-5.0.0pro -d -v /var/opt/jfrog/artifactory:/var/opt/jfrog/artifactory -p 8081:8081 docker.bintray.io/jfrog/artifactory-pro:latest

This mounts the /var/opt/jfrog/artifactory directory on your host machine to the container's /var/opt/jfrog/artifactory and will then be used by Artifactory for configuration and data.

Using a Docker Named Volume

In this case, you create a docker named volume and pass it to the container. By default, the named volume is a local directory under /var/lib/docker/volumes/<name>, but can be set to work with other locations. For more details, please refer to the Docker documentation for 

Newtablink
TextDocker Volumes
URLhttps://docs.docker.com/engine/reference/commandline/volume_create/
.

The example below creates a Docker named volume called artifactory_data and mounts it to the Artifactory container under /var/opt/jfrog/artifactory:

Code Block
$ docker volume create --name artifactory5_data
$ docker run --name artifactory-5.0.0pro -d -v artifactory5_data:/var/opt/jfrog/artifactory -p 8081:8081 docker.bintray.io/jfrog/artifactory-pro:latest

In this case, even if the container is stopped and removed, the volume persists and can be attached to a new running container using the above docker run command. 


Upgrading Artifactory

For details on how to upgrade Artifactory running in a Docker container, please refer to Running in a Docker Container in the Upgrading Artifactory page.  


Running Artifactory With a Different Database

By default, Artifactory runs with an embedded Derby Database that comes built-in, however, Artifactory supports additional databases. To switch to one of the other supported databases, please refer to Changing the Database


Building Artifactory OSS From Sources

The Artifactory OSS Docker image sources are available for download allowing you to build the image yourself. For details, please refer to Building Artifactory OSS


Accessing Artifactory

Once the Artifactory container is up and running, you access Artifactory in the usual way by browsing to: 

Code Block
http://SERVER_DOMAIN:8081/artifactory

For example, if you are testing on your local machine you would use:  http://localhost:8081/artifactory


Troubleshooting Docker

This section describes different ways you can troubleshoot a running or stopped Docker container that is not functioning as expected.

Container State

The docker ps command lists containers in your system.

Code Block
languagebash
$ docker ps     # Lists running containers
$ docker ps -a  # Lists all containers

Logs

Artifactory logs are stored in the Artifactory container under /var/opt/jfrog/artifactory/logs.

If you ran the container with a mounted volume for Artifactory data (/var/opt/jfrog/artifactory/), you can also access the logs locally on your host.

An easy way to see the logged output of a running container is through the docker logs command

Code Block
languagebash
$ docker logs <container name>

This will output all of the container's STDOUT and STDERR to the screen both for running and stopped containers.

Connect to a Running Container

You can connect to a running container's file system and open an interactive command prompt in the container with the docker exec command

Code Block
languagebash
$ docker exec -it <container name> /bin/bash

This will open a command prompt in the running Artifactory container, logging you in as root and placing you in the / directory.

Run an Alternate Entrypoint 

There are cases where you want to run the container, but not start up Artifactory. To do this, you need to override the configured entrypoint script using docker run --entrypoint=bash

Code Block
languagebash
$ docker run -it --entrypoint=/bin/bash -v /var/opt/jfrog/artifactory:/var/opt/jfrog/artifactory -p 8081:8018 docker.bintray.io/jfrog/artifactory-pro:latest

This will run the container, presenting you with a prompt in the container, but without executing the /entrypoint-artifactory.sh file.

You can then make changes to the container configuration execute /entrypoint-artifactory.sh to start up Artifactory in your container.


Watch the Screencast

HTML
<iframe width="560" height="315" src="https://www.youtube.com/embed/SG9rtyXsEXU" frameborder="0" allowfullscreen></iframe>