如何在docker artifactory容器中将自己定位的文件夹用作卷?

前端之家收集整理的这篇文章主要介绍了如何在docker artifactory容器中将自己定位的文件夹用作卷?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在按照这些说明运行一个神器容器:https://www.jfrog.com/confluence/display/RTF/Running+with+Docker

它工作和神器已启动并运行,但这样我就无法使用自己的主机目录作为容器卷进行链接.该指南说要使用

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

运行容器时的选项,但这样我得到的卷存储在一些/ 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

这应该意味着导出ARTIFACTORY_HOME = / var / opt / jfrog / artifactory尚未执行(无论您是否使用卷).

这也意味着您应该使用-e ARTIFACTORY_HOME = / var / opt / jfrog / artifactory环境选项执行docker run.

另见这support thread.

OP Mikyjpeg增加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.

猜你在找的Docker相关文章