Monday, November 16, 2020

Setup JFrog Artifactory on Ubuntu 18.0.4 using Docker | Install JFrog Artifactory on Ubuntu

Artifactory is one of the popular Binary repository manager. It is Java based tool, used for storing artifacts. Artifactory can be integrated with many Continuous integration and Continuous delivery tools. Artifactory is mainly used by Ant, Maven and Gradle build tools.

Let us see how to configure Artifactory on Ubuntu 18.0.4 using Docker. We will configure Artifactory by doing the three steps:

1. Install Docker on Ubuntu 18.0.4
2. Download Artifactory image
3. Spin up a container using the Artifactory image 

Choose at least small or medium instance type (2GB RAM)
ports 8081 and 8082 needs to be opened.
8081 for Artifactory REST APIs.
8082 for everything else (UI, and all other product’s APIs). 

1. Install Docker on Ubuntu

sudo apt-get update && sudo apt install -y

If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with something like:
sudo usermod -aG docker $USER
Run the command below to see a version of docker installed. 
docker --version

Step 2: Download Artifactory Docker image

There are different editions of JFrog Artifactory available, let us use open source version.

Pull the latest Docker image of JFrog Artifactory.
sudo docker pull

Display docker images
sudo docker images

Step 3: Create Data Directory

Create data directory on host system to ensure data used on container is persistent.
sudo mkdir -p /jfrog/artifactory
sudo chown -R 1030 /jfrog/

Step 4: Start JFrog Artifactory container

To start an Artifactory container, use the command:
sudo docker run --name artifactory -d -p 8081:8081 -p 8082:8082 \
-v /jfrog/artifactory:/var/opt/jfrog/artifactory \

Step 5: Run Artifactory as a service

sudo vi /etc/systemd/system/artifactory.service
 # Copy the below code highlighted in green 
Description=Setup Systemd script for Artifactory Container

ExecStartPre=-/usr/bin/docker kill artifactory
ExecStartPre=-/usr/bin/docker rm artifactory
ExecStart=/usr/bin/docker run --name artifactory -p 8081:8081 -p 8082:8082 \
  -v /jfrog/artifactory:/var/opt/jfrog/artifactory \
ExecStop=-/usr/bin/docker kill artifactory
ExecStop=-/usr/bin/docker rm artifactory


Reload Systemd
sudo systemctl daemon-reload

Then start Artifactory container with systemd.
sudo systemctl start artifactory
Enable it to start at system boot.
sudo systemctl enable artifactory
Check whether Artifactory is running? 
sudo systemctl status artifactory

Step 6: Access Artifactory Web Interface

You should see Artifactory welcome page like below.

Step 7: Login to Artifactory

Login with default username and password which is admin/password

After Login, click on Get started. Now reset admin password. Enter Admin$321/Admin$321

Skip for base URL and skip proxy setup
Click Next

That's it! Artifactory is setup successfully.

1 comment:

  1. Interesting, and how can I push a docker image into artifactory?


Create Freestyle job in Jenkins | How to create build job in Jenkins to automate Java build and deployment of WAR into Tomcat | Bitbucket Jenkins Integration

Jenkins is popular open source Continuous integration tool. It was written entirely in Java. Jenkins is a self-contained automation server u...