如何将自己定位的文件夹用作 docker 人工制品容器中的卷?
How can I use own located folders as volumes in docker artifactory container?
我正在按照这些说明运行 一个人造容器:https://www.jfrog.com/confluence/display/RTF/Running+with+Docker
它可以工作并且 artifactory 已经启动并且 运行ning 但是这样我就不能使用我自己的主机目录作为容器卷链接。指南说使用
-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 运行ing the container 但通过这种方式我得到卷存储在一些 /var/lib/docker/volumes/.. 子文件夹中。我想要的是将这些卷安装在我主机的 /opt/artifactory/
中
所以我尝试以这种方式使用卷映射:
-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
但我得到这个错误:
** ERROR: Artifactory home folder not defined or does not exists at
有人试过这个吗?我该如何管理它?
谢谢,
米歇尔
Artifactory home folder not defined or does not exists at
这应该意味着 export ARTIFACTORY_HOME=/var/opt/jfrog/artifactory
还没有被执行(无论你是否使用卷)。
这也意味着您应该使用 -e ARTIFACTORY_HOME=/var/opt/jfrog/artifactory
环境选项执行 docker run
。
另请参阅此 support thread。
OP Mikyjpeg adds :
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.
我正在按照这些说明运行 一个人造容器:https://www.jfrog.com/confluence/display/RTF/Running+with+Docker
它可以工作并且 artifactory 已经启动并且 运行ning 但是这样我就不能使用我自己的主机目录作为容器卷链接。指南说使用
-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 运行ing the container 但通过这种方式我得到卷存储在一些 /var/lib/docker/volumes/.. 子文件夹中。我想要的是将这些卷安装在我主机的 /opt/artifactory/
中所以我尝试以这种方式使用卷映射:
-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
但我得到这个错误:
** ERROR: Artifactory home folder not defined or does not exists at
有人试过这个吗?我该如何管理它?
谢谢, 米歇尔
Artifactory home folder not defined or does not exists at
这应该意味着 export ARTIFACTORY_HOME=/var/opt/jfrog/artifactory
还没有被执行(无论你是否使用卷)。
这也意味着您应该使用 -e ARTIFACTORY_HOME=/var/opt/jfrog/artifactory
环境选项执行 docker run
。
另请参阅此 support thread。
OP Mikyjpeg adds
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 hostetc
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.