Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use own located folders as volumes in docker artifactory container?

I'm following these instructions in order to run an artifactory container: https://www.jfrog.com/confluence/display/RTF/Running+with+Docker

It works and artifactory is up and running but in this way I cannot use my own host directory to be linked as container volumes. The guide says to use

-v /var/opt/jfrog/artifactory/etc
-v /var/opt/jfrog/artifactory/data
-v /var/opt/jfrog/artifactory/backup
-v /var/opt/jfrog/artifactory/logs

options when running the container but in this way I obtain that the volumes are stored in some /var/lib/docker/volumes/.. subfolders. What I'd like is to have these volumes mounted for example in my host's /opt/artifactory/

So I've tried to use the volume mapping in this way:

-v /opt/artifactory/etc:/var/opt/jfrog/artifactory/etc
-v /opt/artifactory/data:/var/opt/jfrog/artifactory/data
-v /opt/artifactory/backup:/var/opt/jfrog/artifactory/backup
-v /opt/artifactory/logs:/var/opt/jfrog/artifactory/logs

but I obtain this error:

** ERROR: Artifactory home folder not defined or does not exists at

Does anybody already tried this before? How can I manage it?

Thanks, Michele.

like image 751
Mikyjpeg Avatar asked Oct 18 '22 22:10

Mikyjpeg


1 Answers

Artifactory home folder not defined or does not exists at

That should be means export ARTIFACTORY_HOME=/var/opt/jfrog/artifactory has not be executed (whether or not you are using volumes).

That also mean you should execute docker run with a -e ARTIFACTORY_HOME=/var/opt/jfrog/artifactory environment option.

See also this support thread.


The OP Mikyjpeg adds in the comments:

I eventually found the problem:
There is a file in the /var/opt/jfrog/artifactory/etc folder of the container that sets all the environment variables. This file is erased by the volume mapping (as it does not exist on my host), it is recreated when the command starts but with a different content.
So I have copied this file from a working container, put into my host etc mapped volume and run again. And now it works.

I was supposing that the -v option creates empty volumes in either cases but now I know that it is not true.

like image 138
VonC Avatar answered Oct 21 '22 21:10

VonC