I want to install Jfrog artifactory in a docker container for me to deploy my artifacts…
- User
I want to install Jfrog artifactory in a docker container for me to deploy my artifacts and be able to see them in a webconsole
- Assistant
I want to install Jfrog artifactory in a docker container for me to deploy my artifacts and be able to see them in a webconsole
Installing JFrog Artifactory in a Docker container is a straightforward process. Below is a step-by-step guide to help you set up Artifactory, deploy your artifacts, and access them via the web console.
Docker Installed: Ensure that Docker is installed on your machine. You can download and install Docker from here.
Docker Compose (Optional): For more complex setups, Docker Compose can be useful. Install it from here.
JFrog provides both OSS (Open Source) and Pro (Professional) editions. For basic usage, the OSS version should suffice. However, if you need advanced features, consider using the Pro version.
To pull the latest OSS version:
docker pull releases-docker.jfrog.io/jfrog/artifactory-oss:latest
For the Pro version, replace the image name accordingly, ensuring you have the necessary licenses.
To ensure that your data persists across container restarts or removals, map Docker volumes to host directories.
mkdir -p ~/artifactory/data
mkdir -p ~/artifactory/ssl
Optional: If you plan to use SSL, place your SSL certificates in the ~/artifactory/ssl directory.
Run the container using the docker run command, mapping the necessary ports and volumes.
docker run --name artifactory -d \
-p 8081:8081 \
-p 8082:8082 \
-v ~/artifactory/data:/var/opt/jfrog/artifactory \
releases-docker.jfrog.io/jfrog/artifactory-oss:latest
Explanation of Parameters:
--name artifactory: Names the container "artifactory".-d: Runs the container in detached mode.-p 8081:8081: Maps port 8081 of the container to port 8081 on the host for the web interface.-p 8082:8082: Maps port 8082 for repositories (optional, depending on your needs).-v ~/artifactory/data:/var/opt/jfrog/artifactory: Mounts the host directory for persistent data.If using Docker Compose, you can use the following docker-compose.yml file instead:
version: '3'
services:
artifactory:
image: releases-docker.jfrog.io/jfrog/artifactory-oss:latest
container_name: artifactory
ports:
- "8081:8081"
- "8082:8082"
volumes:
- ~/artifactory/data:/var/opt/jfrog/artifactory
Then start the service with:
docker-compose up -d
http://localhost:8081/artifactory (replace localhost with your server's IP if not running locally).You can deploy artifacts to Artifactory using various methods:
Web Interface:
Using REST API:
Using Build Tools:
For secure access, it's recommended to enable SSL. Here's a basic outline:
Obtain SSL Certificates: Get your SSL certificate and key files (e.g., cert.pem and key.pem).
Place Certificates: Put them in the ~/artifactory/ssl directory.
Modify Docker Run Command:
docker run --name artifactory -d \
-p 8081:8081 \
-p 8082:8082 \
-v ~/artifactory/data:/var/opt/jfrog/artifactory \
-v ~/artifactory/ssl:/var/opt/jfrog/artifactory/tomcat/ssl \
-e ARTIFACTORY_SSL_CERT=/var/opt/jfrog/artifactory/tomcat/ssl/cert.pem \
-e ARTIFACTORY_SSL_KEY=/var/opt/jfrog/artifactory/tomcat/ssl/key.pem \
releases-docker.jfrog.io/jfrog/artifactory-oss:latest
Adjust paths and environment variables as needed based on your SSL setup.
Stop the Container:
docker stop artifactory
Start the Container:
docker start artifactory
View Logs:
docker logs -f artifactory
Remove the Container:
docker rm -f artifactory
Note: Removing the container does not delete the data stored in the mounted volumes.
Back Up Data: Regularly back up the ~/artifactory/data directory to prevent data loss.
Monitor Resources: Ensure your Docker host has sufficient resources (CPU, RAM, Disk) allocated to Artifactory.
Security:
Updates: To update Artifactory, pull the latest image and recreate the container:
docker pull releases-docker.jfrog.io/jfrog/artifactory-oss:latest
docker stop artifactory
docker rm artifactory
docker run ... [same as before]
Ensure data is persisted via volumes before updating.
Integrations: Explore integrations with CI/CD tools, Docker registries, and other services through Artifactory’s extensive feature set.
By following the above steps, you should have a functional JFrog Artifactory instance running in a Docker container, ready to manage and deploy your artifacts via the web console.
Not yet included in a published release.