Using the latest version?
JFrog Platform User Guide
JFrog Artifactory 6.x Documentation
To get the latest version, go to the JFrog Unified Platform
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:
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
docker run ... -e PARAM=<value>
The following table describes the parameters supported:
DB_TYPE | Values: postgresql, mysql, mariadb, oracle 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_URL | The full database URL Defaults to the value set in the corresponding |
DB_USER | The database username Defaults to the value set in the corresponding |
DB_PASSWORD | The database password Defaults to the value set in the corresponding |
DB_POOL_MAX_ACTIVE | The maximum number of pooled database connections. Sets the pool.max.active property in the corresponding db.properties file |
DB_POOL_MAX_IDLE | The maximum number of pooled idle database connections. Sets the pool.max.idle property 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 according to the variables passed.
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.
$ 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.
$ 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.