How to run Artifactory as root in the 6.2+ Docker images

Patrick Russell
2018-09-05 17:00


Since Artifactory 6.2 we no longer use the root user to run the Artifactory daemon, possibly causing problems. 

Affected Versions

6.2 -> Latest

A major change in the Artifactory Docker image is that instead of using the "root" user in the container, we instead now use an "artifactory" non-root user. This may cause permission problems or the following Docker error:

2018-08-24T14:26:52.206285-07:00 sg32d01ls-geo02060301 dockerd: time="2018-08-24T14:26:52.205969296-07:00" level=error msg="b706c62725ed87665c8652e0a4a237e22c8a942b33fdf58f7f35a8e90dc7b994 cleanup: failed to delete container from containerd: no such container"

2018-08-24T14:26:52.206450-07:00 sg32d01ls-geo02060301 dockerd: time="2018-08-24T14:26:52.206000976-07:00" level=error msg="Handler for POST /v1.38/containers/b706c62725ed87665c8652e0a4a237e22c8a942b33fdf58f7f35a8e90dc7b994/start returned error: OCI runtime start failed: container process is already dead: unknown"


The solution is to create a new Docker image that uses the root user to run Artifactory. To create a new Artifactory 6.2 or 6.3 container that runs Artifactory as the root user, follow the procedure outlined below:

1. Create a new directory and save the following text as a Dockerfile:

mkdir artifactory-pro-test
cd artifactory-pro-test
vim Dockerfile

2. Paste the following contents into the Dockerfile:

USER root


ENTRYPOINT ["/bin/bash", "/"]

3] Build the docker image:

 docker build .


Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM
Successfully built 33cb1446532f

4] Run the built image:

docker run -d -p 8081:8081 –name arttest 33cb1446532f