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

By default, Artifactory runs with an embedded Derby database that comes built-in. However, Artifactory supports additional databases as described in Configuring the Database

To configure your Artifactory Docker container to run with one of the other supported databases, you need to:

  1. Mount the relevant database driver into Artifactory's tomcat/lib directory

    Info
    titleUsing PostgreSQL

    If you are changing the database to PostgreSQL, not note that the Artifactory Docker image comes pre-loaded with the PostgreSQL database driver.

  2. Pass environment variables to Artifactory in the docker run command
  3. Pass database parameters as Docker environment variables telling Artifactory how to configure the database in the docker run command
Panel
titlePage contents

Table of Contents
maxLevel4
minLevel2
 


Mounting the Database Driver

To mount the database driver, you first need to download its corresponding jar file from the vendor's web site provided in the following links:

 


Passing Environment Variables

Once you have the downloaded the database driver JAR file, you mount it into the Artifactory container using docker run with the -v option:

 

Code Block
docker run ... -v </path/to/driver.jar>:/opt/jfrog/artifactory/tomcat/lib/<driver.jar>

Without passing the DB parameters mentioned below, Artifactory will ignore the added jar.


Pass Database Parameters

For Artifactory in Docker to know what database to use, you need to pass in some parameters as Docker environment variables using docker run with the -e option

 

Code Block
docker run ... -e PARAM=<value>

The following table describes the parameters supported:

DB_TYPE

Values: postgresqlmysqloracle or mssql

Default: blank indicating Artifactory should run with the built-in Derby database

DB_HOST

The hostname/ip of the server where the database is installed

If this value is omitted, DB_HOST defaults to the value set in DB_TYPE

DB_PORT

The database port

Defaults to the value set in the corresponding db.properties file

DB_URL

The full database URL

Defaults to the value set in the corresponding db.properties file

DB_USER

The database username

Defaults to the value set in the corresponding db.properties file

DB_PASSWORD

The database password

Defaults to the value set in the corresponding db.properties file

During execution of the docker run, an entrypoint script will copy the matching db.properties from the misc/db/ directory to the etc/ directory and configure it.

If etc/db.properties already exists, the script will just validate it and Artifactory will work with the specified database. 


Examples

Below are examples that show how Artifactory can be run in Docker with a custom database.

PostgreSQL

In this example for PostgreSQL, since only DB_TYPE is specified, the rest of the parameters will be set to their defaults taken from the PostgreSQL db.properties file.

The PostgreSQL database driver is already in the Artifactory Docker image, so you don't need to mount it.

 

Code Block
$ docker run -d --name artifactory-5 \
             -e DB_TYPE=postgresql \
             -v /var/opt/jfrog/artifactory:/var/opt/jfrog/artifactory \
             -p 8081:8081 docker.bintray.io/jfrog/artifactory-pro:latest

You can verify that Artifactory is running with PostgreSQL under Admin | System Info which specifies the Database Type.

MySQL

This example for MySQL uses custom database host, port, username and password settings.

The MySQL database driver is mounted in to the container's /opt/jfrog/artifactory/tomcat/lib/ directory.

 

Code Block
$ docker run -d --name artifactory-5 \
             -e DB_TYPE=mysql \
             -e DB_HOST=mysql5srv.jfrog.local \
             -e DB_PORT=33307 \
             -e DB_USER=artifactory17 \
             -e DB_PASSWORD=pass17arti56_x \
             -v ~/mysql-connector-java-5.1.40-bin.jar:/opt/jfrog/artifactory/tomcat/lib/mysql-connector-java-5.1.40-bin.jar \
             -v /var/opt/jfrog/artifactory:/var/opt/jfrog/artifactory \
             -p 8081:8081 docker.bintray.io/jfrog/artifactory-pro:latest

You can verify that Artifactory is running with MySQL under Admin | System Info which specifies the Database Type.