Run Artifactory inside a Docker container.
backup directories are exported as volumes:
/artifactory/data /artifactory/logs /artifactory/backup
The web server is accessible through port
To run artifactory do:
docker run -p 8080:8080 mattgruter/artifactory
Now point your browser to http://localhost:8080
The artifactory servlet is available at the
artifactory/ path. However a filter redirects all paths outside of
artifactory/ to the artifactory servlet. Thus instead of linking to the URL http://localhost:8080/artifactory/libs-release-local you can just link to http://localhost:8080/libs-release-local (i.e. omitting the subpath
Inject the environment variable
RUNTIME_OPTS when starting a container to set Tomcat's runtime options (i.e.
CATALANA_OPTS). The most common use case is to set the heap size:
docker run -e RUNTIME_OPTS="-Xms256m -Xmx512m" -P mattgruter/artifactory
Switching to Artifactory Pro
If you are using Artifactory Pro, the artifactory war archive has to be replaced. The image tagged
-onbuild is built with an
ONBUILD trigger for this purpose. Unpack the Artifactory Pro distribution ZIP file and place the file
artifactory.war (located in the archive) in the same directory as a simple Dockerfile that extends the
# Dockerfile for Artifactory Pro FROM mattgruter/artifactory:latest-onbuild
Now build your child docker image:
docker build -t yourname/myartifactory .
ONBUILD trigger ensures your
artifactory.war is picked up and applied to the image upon build.
docker run -P yourname/myartifactory
how can I mount the data locally not in the container, because if I shut down the container the maven I have installed will disappear
As you mentioned, I would suggest to make sure you install JDK 8 and update your JAVA_HOME environment variable to point to your JDK 8 installation.
- If you installed Artifactory as a Linux service, browse to your $ARTIFACTORY_HOME/bin directory and execute the following command as root:$ARTIFACTORY_HOME/bin/installService.sh
@chaya56 I see that also on the production server, but it works locally. hm.
I'm using Artifactory Pro version 4.0.2. I successfully built image following your instructions.
When I run however Artifactory fails to start:
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
I attached to the running container and found this in the Tomcat log:
Aug 20, 2015 1:40:48 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Error configuring application listener of class org.artifactory.webapp.servlet.ArtifactoryHomeConfigListener java.lang.UnsupportedClassVersionError: org/artifactory/webapp/servlet/ArtifactoryHomeConfigListener : Unsupported major.minor version 52.0 (unable to load class org.artifactory.webapp.servlet.ArtifactoryHomeConfigListener)
I thought perhaps an upgrade to Java 8 would resolve the issue but I was unsuccessful in finding a way to do that.
Hello Mattgrutter, thanks for this image, but it seems i 've an infinite loop when i try to access to webserver: 192.168.1.11:8080/artifactory/artifactory/artifactory/artifactory/artifactory etc...
@kamranazeem Yes it's because of the
ONBUILD trigger in the image. The latest version of the image (build date June 30) doesn't have the trigger anymore so you're image should build now.
If you however rely on the
ONBUILD trigger you can from now on use the images tagged with "*-onbuild".
Hi, I am trying to build artifactory using your image. When I try to build, I do not see a success message, nor I see kamran/artifactory appearing in my list of images. What could be wrong? Is it because I do not have a artifactory.war (as I am using OSS version, not PRO version? Is it because the ONBUILD fails, and then the image is not built successfully?
The Docker file:
[root@centos7-1-docker artifactory]# cat Dockerfile
The build attempt:
[root@centos7-1-docker artifactory]# docker build -t kamran/artifactory .
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
Step 0 : FROM mattgruter/artifactory
Executing 1 build triggers
Trigger 0, ADD ./artifactory.war webapps/
Step 0 : ADD ./artifactory.war webapps/
INFO artifactory.war: no such file or directory
I use the tomcat image as the base and install the artifactory webapp as a tomcat application. Tomcat itself is started when you create the container (see the Dockerfile of the tomcat base image).