0
votes

I am trying to run Artifactory in a Docker container on Windows 10 locally on my laptop. However, when I launch the docker container with this command:

docker run --name artifactory -v $env:JFROG_HOME/artifactory/var/:/var/opt/jfrog/artifactory -d -p 8081:8081 -p 8082:8082 docker.bintray.io/jfrog/artifactory-cpp-ce:latest

And I try to access: http://192.168.17.1/artifactory, I eventually get:

{
  "errors" : [ {
    "status" : 500,
    "message" : "Artifactory failed to initialize: check Artifactory logs for errors."
  } ]
}

The content of system.yaml is:

configVersion: 1
shared:
    node:
        id: 192.168.17.1
        ip: 192.168.17.1

and the log:

2020-09-08T20:49:29.438Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [ifactoryApplicationContext:558] [art-init            ] - Artifactory application context set to NOT READY by refresh
2020-09-08T20:49:33.231Z [jfrt ] [WARN ] [ee3f97d86edfcb96] [c.z.h.u.DriverDataSource:70   ] [art-init            ] - Registered driver with driverClassName=org.apache.derby.jdbc.EmbeddedDriver was not found, trying direct instantiation.
2020-09-08T20:49:33.266Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [o.a.s.d.v.DerbyValidator:26   ] [art-init            ] - Validating connection collation for derby database
2020-09-08T20:49:34.537Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [ritiesStorageServiceFactory:25] [art-init            ] - Initializing DB-based Priorities Storage Service
2020-09-08T20:49:35.945Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [actorySchedulerFactoryBean:727] [art-init            ] - Starting Quartz Scheduler now
2020-09-08T20:49:36.004Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [ifactoryApplicationContext:280] [art-init            ] - Artifactory context starting up 47 Spring Beans...
2020-09-08T20:49:36.287Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [o.a.s.a.AccessServiceImpl:459 ] [art-init            ] - Initialized new service id: jfrt@01ehqnp119ag0r0mzvsm9j12dh
2020-09-08T20:49:36.323Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [oryAccessClientConfigStore:608] [art-init            ] - Using Access Server URL: http://localhost:8046/access source: System Config
2020-09-08T20:49:38.191Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [o.j.c.ExecutionUtils:142      ] [pool-23-thread-1    ] - Cluster join: Retry 5: Service registry ping failed, will retry. Error while trying to connect to service registry (status = 404). Please review router request log for additional information
2020-09-08T20:49:43.203Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [o.j.c.ExecutionUtils:142      ] [pool-23-thread-2    ] - Cluster join: Retry 10: Service registry ping failed, will retry. Error while trying to connect to service registry (status = 404). Please review router request log for additional information
2020-09-08T20:49:48.214Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [o.j.c.ExecutionUtils:142      ] [pool-23-thread-1    ] - Cluster join: Retry 15: Service registry ping failed, will retry. Error while trying to connect to service registry (status = 404). Please review router request log for additional information
...
2020-09-08T20:50:58.371Z [jfrt ] [INFO ] [ee3f97d86edfcb96] [o.j.c.ExecutionUtils:142      ] [pool-23-thread-1    ] - Cluster join: Retry 85: Service registry ping failed, will retry. Error while trying to connect to service registry (status = 404). Please review router request log for additional information
2020-09-08T20:51:03.382Z [jfrt ] [ERROR] [ee3f97d86edfcb96] [o.j.c.ExecutionUtils:155      ] [pool-23-thread-2    ] - Cluster join: Service registry ping failed; Error while trying to connect to service registry (status = 404). Please review router request log for additional information
2020-09-08T20:51:03.390Z [jfrt ] [ERROR] [ee3f97d86edfcb96] [ctoryContextConfigListener:126] [art-init            ] - Application could not be initialized: HTTP response status 404:Failed on executing /api/v1/system/ping, with response: Not Found

Not sure why we see localhost in the following log:

Using Access Server URL: http://localhost:8046/access source: System Config

Why is it not using 192.168.17.1, the address configured in system.yaml?

2

2 Answers

0
votes

I am not sure why I kept receiving 404 error in my setup, but I think it has to do with file permissions. JFrog recommends that we perform the following commands to get the Docker container to run:

mkdir -p $JFROG_HOME/artifactory/var/etc/
cd $JFROG_HOME/artifactory/var/etc/
touch ./system.yaml
chown -R 1030:1030 $JFROG_HOME/artifactory/var
chmod -R 777 $JFROG_HOME/artifactory/var

and then run the container with:

docker run --name artifactory -v $JFROG_HOME/artifactory/var/:/var/opt/jfrog/artifactory -d -p 8081:8081 -p 8082:8082 docker.bintray.io/jfrog/artifactory-<pro|oss|cpp-ce>:latest

However, since I am running the container on Windows, I could not perform the setting of the file permissions with touch, chown and chmod. This seems to be the reason why Artifactory fails to work on my setup. When I start the Docker container without the -v option, I can connect to the Artifactory web application accessing URL address http://localhost:8081/artifactory.

I am not sure if there is a way to set the file permissions on Windows to be able to launch the container with the -v option.

0
votes

There's a simpler method available on the jfrog website, this uses a proper docker volume instead of mounting a directory. Here are the three steps necessary:

docker volume create artifactory-data
docker pull releases-docker.jfrog.io/jfrog/artifactory-oss:latest
docker run -d --name artifactory -p 8082:8082 -p 8081:8081 -v artifactory-data:/var/opt/jfrog/artifactory releases-docker.jfrog.io/jfrog/artifactory-oss:latest

When Artifactory has finished starting up (takes a while), follow the post installation steps.