Docker:无法创建目录‘/opt/jfrog/artifactory/logs’:权限被拒绝

Docker:无法创建目录‘/opt/jfrog/artifactory/logs’:权限被拒绝

我正在尝试配置一个docker镜像,以便与已安装的卷一起运行,以实现持久性。该镜像是官方的artifactory镜像。我觉得很奇怪,在创建几个带有“权限被拒绝”的目录后,它会停止。

当我检查已安装的卷时,我可以看到在尝试上传映像时创建了几个文件夹。并且数据库配置也正常。

深入挖掘一下,这个人似乎有权限问题artifactory:

然而,我无法进一步解释或纠正该问题。

---
Found java executable in JAVA_HOME (/usr/lib/jvm/java-8-openjdk-amd64)
mkdir: cannot create directory ‘/opt/jfrog/artifactory/logs’: Permission denied

** Could not create dir /opt/jfrog/artifactory/logs/catalina


Preparing to run Artifactory in Docker
=====================================
2017-03-17 12:51:17   [42 entrypoint-artifactory.sh] Checking open files and processes limits

2017-03-17 12:51:17   [45 entrypoint-artifactory.sh] Current max open files is 65536

2017-03-17 12:51:17   [57 entrypoint-artifactory.sh] Current max open processes is unlimited

2017-03-17 12:51:17   [67 entrypoint-artifactory.sh] Checking if /var/opt/jfrog/artifactory is mounted

2017-03-17 12:51:18   [72 entrypoint-artifactory.sh] /var/opt/jfrog/artifactory is mounted

2017-03-17 12:51:18   [78 entrypoint-artifactory.sh] Setting up data directories if missing

2017-03-17 12:51:18   [88 entrypoint-artifactory.sh] Create artifactory user if missing

2017-03-17 12:51:18   [94 entrypoint-artifactory.sh] User artifactory already exists

2017-03-17 12:51:18  [101 entrypoint-artifactory.sh] Checking permissions on /opt/jfrog/artifactory

2017-03-17 12:51:18  [110 entrypoint-artifactory.sh] /opt/jfrog/artifactory is already owned by artifactory:artifactory.

2017-03-17 12:51:18  [114 entrypoint-artifactory.sh] Checking permissions on /var/opt/jfrog/artifactory

2017-03-17 12:51:18  [120 entrypoint-artifactory.sh] /var/opt/jfrog/artifactory is owned by root:root. Setting to artifactory:artifactory.

2017-03-17 12:51:18  [246 entrypoint-artifactory.sh] Checking DB_TYPE

2017-03-17 12:51:18  [249 entrypoint-artifactory.sh] DB_TYPE is set to mysql

2017-03-17 12:51:18  [177 entrypoint-artifactory.sh] DB_HOST is set to x.y.s.w

2017-03-17 12:51:18  [179 entrypoint-artifactory.sh] Checking if need to copy mysql configuration

2017-03-17 12:51:18  [182 entrypoint-artifactory.sh] /var/opt/jfrog/artifactory/etc/db.properties already exists. Making sure it's set to mysql... 

2017-03-17 12:51:18  [185 entrypoint-artifactory.sh] /var/opt/jfrog/artifactory/etc/db.properties already set to mysql

2017-03-17 12:51:18  [154 entrypoint-artifactory.sh] Waiting for DB mysql to be ready on 104.196.117.4/3306 within 30 seconds

2017-03-17 12:51:18  [159 entrypoint-artifactory.sh] DB mysql up in 0 seconds
---
Found java executable in JAVA_HOME (/usr/lib/jvm/java-8-openjdk-amd64)
mkdir: cannot create directory ‘/opt/jfrog/artifactory/logs’: Permission denied

答案1

当我将 nfs 挂载点共享为卷时,我遇到了同样的问题。这解决了它:

docker-compose up --force-recreate

希望这能解决您的问题!

答案2

我遇到了同样的问题,并且我已经找到了让您的容器顺利运行的方法。

只需拨打# sudo chmod -R 777 /data

因为 /data 是每个容器的卷挂载,并且由于权限被拒绝而导致artifactory容器失败

容器名称 1. docker.bintray.io/jfrog/nginx-artifactory-pro 2. docker.bintray.io/jfrog/artifactory-pro 3. docker.bintray.io/postgres

更改后等待 2-3 分钟

相关内容