Deploy JFrog Artifactory Container with Docker Compose

Introduction

JFrog is a company that provides a set of universal DevOps solutions, primarily focusing on artifact management. The company’s flagship product is Artifactory, which is a universal artifact repository manager. Artifactory manages the build artifacts of your software projects, including binaries, libraries, and other dependencies.

Prerequisites

  • Minimum 2 core CPU and 4 GB memory required.
  • Basic knowledge of Docker.
  • Basic knowledge of Linux commands.
  • Up and running Docker.

To install Docker and docker compose on ubuntu 22.04 LTS, We can use the given link.

In this post, We will deploy JFrog Artifactory container using Docker Compose on Ubuntu 22.04 LTS machine.

Step 1: Creating docker-compose.yml

To deploy JFrog Artifactory using Docker Compose, you can create a docker-compose.yml file that defines the necessary services and configurations. Below is a basic example to help you get started. This example uses the official JFrog Artifactory Docker image.

To create a docker-compose.yml

sudo nano docker-compose.yml

Copy and paste the followings configuration.

version: '3'

services:
  artifactory:
    image: docker.bintray.io/jfrog/artifactory-pro
    container_name: artifactory
    ports:
      - "8081:8081"
    environment:
      - ARTIFACTORY_HOME=/var/opt/jfrog/artifactory
      - EXTRA_JAVA_OPTIONS=-Xms512m -Xmx2g
    volumes:
      - ./artifactory_data:/var/opt/jfrog/artifactory
    networks:
      - artifactory-network

networks:
  artifactory-network:
    driver: bridge

Save this configuration in a file named docker-compose.yml. This example uses the Artifactory Professional Docker image and exposes the Artifactory web interface on port 8081. Adjust the configuration based on your requirements.

To deploy the services defined in the docker-compose.yml file, follow these steps:

  • Create a directory for your Docker Compose project.
  • Create the docker-compose.yml file with the content provided above.
  • Open a terminal and navigate to the directory containing the docker-compose.yml file.

Save and exit from the text editor.

Step 2: Deploy JFrog Container

To deploy this nexus service, follow these steps, Run the following command to start the nexus container:

sudo docker-compose up -d

The -d flag runs the containers in the background, It will take few sec or mins to pull the image and deploy the nexus.

After the services are started, you can access Artifactory by navigating to http://localhost:8081 in your web browser. The default credentials are:

Usernameadmin
Password password

Note: For a production environment, it’s recommended to change the default credentials and configure Artifactory securely.

Step 3: Validate the Container

To check the running containers launched by Docker Compose, you can use the following command:

sudo docker-compose ps

This command provides a summary of the status of each service defined in your docker-compose.yml file. It shows information such as the service name, container ID, status, ports, and names.

Here’s an example of what the output might look like:

   Name                 Command            State               Ports
-------------------------------------------------------------------------
jfrog   docker-entrypoint.sh jfrog   Up      0.0.0.0:8081->8081/tcp

Step 4: Logging

Some time we need to also check the real time logs, So we can use the given commands.

sudo docker-compose logs -f jfrog

Step 5: Destroy JFrog Container

To destroy (stop and remove) the Jfrog container launched with Docker Compose, you can use the following command in the directory where your docker-compose.yml file is located:

sudo docker-compose down

This command stops and removes all the containers, networks, and volumes defined in your docker-compose.yml file.

The down command stops and removes the containers but retains the data volumes by default. If you want to remove the volumes as well, you can use the -v option:

Make sure you are in the correct directory containing your docker-compose.yml file when running these commands. This ensures that Docker Compose identifies the correct configuration file.

After running the docker-compose down command, you can use the docker-compose ps command to verify that the containers are no longer running. The output should be empty, indicating that no containers are currently running.

Remember that this command will stop and remove all the services defined in your docker-compose.yml file, not just the nexus service. If you only want to remove a specific service, you can specify the service name:

docker-compose down -v <service_name>

Replace <service_name> with the actual name of the service you want to remove.

Conclusion

We have successfully deployed Jfrog container using Docker Compose on Ubuntu 22.04 LTS machine, If you still have questions, please post them in the comments section below.

Author

Deploy JFrog Artifactory Container with Docker Compose
Scroll to top