Artifactory on Docker

Artifactory is a binary store solution in short. You could use it as a storage to store artifacts as a result of builds. There are paid editions but I’m going with open source edition for my experiments for now.

Prerequisites

I’m going to assume you already the following prerequisites.

Open Port

Execute the following commands to open port 80 for Artifactory UI.

$ sudo firewall-cmd --list-all --add-port=80/tcp --permanent --zone=public
$ sudo firewall-cmd --reload

If you want to accept any traffic trying to access HTTP to the VM, you can alternatively run the following command.

sudo firewall-cmd --add-service=http --permanent --zone=public
sudo firewall-cmd --reload

Create Directory and chown

We will persist the data at /data/artifactory so let’s create the directory.

sudo mkdir -p /data/artifactory

In this example, we will run the container as svcdocker that I have in my Active Directory, so I’m going to change the ownership of the directory. Let the user you want to use own the directory.

sudo chown -R svcdocker:'domain users' /data/artifactory

docker-compose

Copy and paste the text blow in docker-compose.yaml file and place it in your home directory or wherever. One thing to note is I have user as a number. I have “svcdocker” as a domain user but Docker doesn’t seem to be able to figure out “svcdocker” so I gave its id in docker-compose.yaml file. You can figure out the account’s id by executing “id svcdocker”.

version: '3'
services:
  artifactory:
    image: docker.bintray.io/jfrog/artifactory-oss:latest
    container_name: artifactory
    user: '1985601112'
    ports:
     - 80:8081
    volumes:
     - /data/artifactory:/var/opt/jfrog/artifactory
#    environment:
#     - EXTRA_JAVA_OPTIONS=-Xms512m -Xmx4g
    restart: always
    ulimits:
      nproc: 65535
      nofile:
        soft: 32000
        hard: 40000

Once the YAML data is saved in a file, just run the following command.

docker-compose up -d

After a while, Artifactory is ready for you to access its UI. Just browse to the host with your browser and you will be prompted to enter initial password and username. Artifactory’s initial username and password is “admin” and “password” respectively. Once you enter the credential, you will be welcomed with the image below.Lastly, make sure to change the admin password and do whatever to secure Artifactory.

Author: admin

A software engineer in greater Seattle area

Leave a Reply

Your email address will not be published. Required fields are marked *