gpt4 book ai didi

mysql - 无法在 Docker 上加载 Artifactory

转载 作者:行者123 更新时间:2023-11-29 17:18:42 26 4
gpt4 key购买 nike

我无法让 Artifactory 在 Docker 中与 MySQL 一起工作。以下是我收到的错误。

我首先创建一个位置来保存 Artifactory 的文件:

# sudo mkdir /opt/artifactory/docker_volume

使用外部 MySQL 实例设置撰写文件(使用堆栈实例也不起作用,因为堆栈实例从未启动)。

artifactory-oss-mysql.yml:

version: '3'

services:
artifactory:
image: docker.bintray.io/jfrog/artifactory-oss:6.1.0
ports:
- 8081:8081
volumes:
- /opt/artifactory/docker_volume:/var/opt/jfrog/artifactory
- /opt/artifactory/mysql-connector-java-8.0.11/mysql-connector-java-8.0.11.jar:/var/opt/jfrog/artifactory/tomcat/common/lib/mysql-connector-java-8.0.11.jar
environment:
- DB_TYPE=mysql
- DB_USER=artifactory
- DB_HOST=mysql
- DB_PASSWORD=xxx
- DB_URL=jdbc:mysql://my_sql:3306/artdb?characterEncoding=UTF-8&elideSetAutoCommits=true
restart: always
ulimits:
nproc: 65535
nofile:
soft: 32000
hard: 40000

启动堆栈:

# docker stack deploy -c artifactory-oss-mysql.yml artifactory

您会注意到 docker_volume主人已经变了,它下面的一切也变了。唯一的异常(exception)是 mysql 连接器 ( /var/opt/jfrog/artifactory/tomcat/common/lib/mysql-connector-java-8.0.11.jar ),它保留 root 所有权。

# ls -al
drwxr-xr-x 5 root root 4096 Jul 17 17:47 .
drwxr-xr-x 16 root root 4096 Jul 17 15:40 ..
drwxr-xr-x 8 1030 1030 4096 Jul 17 17:47 docker_volume

每个子目录都是空的(除了tomcat中的连接器):

/opt/artifactory/docker_volume # ls -al
total 32
drwxr-xr-x 8 1030 1030 4096 Jul 17 17:47 .
drwxr-xr-x 5 root root 4096 Jul 17 17:47 ..
drwxr-xr-x 2 1030 1030 4096 Jul 17 17:47 access
drwxr-xr-x 2 1030 1030 4096 Jul 17 17:47 backup
drwxr-xr-x 2 1030 1030 4096 Jul 17 17:47 data
drwxr-xr-x 2 1030 1030 4096 Jul 17 17:47 etc
drwxr-xr-x 2 1030 1030 4096 Jul 17 17:47 logs
drwxr-xr-x 3 1030 1030 4096 Jul 17 17:47 tomcat

# docker service logs zh3fiophtdvu

    Preparing to run Artifactory in Docker
=====================================
2018-07-17 21:13:06 [44 entrypoint-artifactory.sh] Dockerfile for this image can found inside the container.
2018-07-17 21:13:06 [45 entrypoint-artifactory.sh] To view the Dockerfile: 'cat /docker/artifactory-oss/Dockerfile.artifactory'.
2018-07-17 21:13:06 [50 entrypoint-artifactory.sh] Checking open files and processes limits
2018-07-17 21:13:06 [53 entrypoint-artifactory.sh] Current max open files is 1048576
2018-07-17 21:13:06 [65 entrypoint-artifactory.sh] Current max open processes is unlimited
2018-07-17 21:13:06 [75 entrypoint-artifactory.sh] Checking if /var/opt/jfrog/artifactory is mounted
2018-07-17 21:13:06 [80 entrypoint-artifactory.sh] /var/opt/jfrog/artifactory is mounted
2018-07-17 21:13:06 [86 entrypoint-artifactory.sh] Setting up data directories if missing
2018-07-17 21:13:06 [97 entrypoint-artifactory.sh] Create artifactory user if missing
2018-07-17 21:13:06 [100 entrypoint-artifactory.sh] User does not exist. Creating it...
2018-07-17 21:13:06 [137 entrypoint-artifactory.sh] Checking permissions on /opt/jfrog/artifactory
2018-07-17 21:13:06 [143 entrypoint-artifactory.sh] /opt/jfrog/artifactory is owned by root:root. Setting to artifactory:artifactory.
2018-07-17 21:13:06 [150 entrypoint-artifactory.sh] Checking permissions on /var/opt/jfrog/artifactory
2018-07-17 21:13:06 [159 entrypoint-artifactory.sh] /var/opt/jfrog/artifactory is already owned by artifactory:artifactory.
2018-07-17 21:13:06 [282 entrypoint-artifactory.sh] Checking DB_TYPE
2018-07-17 21:13:06 [285 entrypoint-artifactory.sh] DB_TYPE is set to mysql
2018-07-17 21:13:06 [34 entrypoint-artifactory.sh] ERROR: No mysql connector found

最佳答案

我会尝试以下方法来更好地理解和解决您的问题:

  • 删除 ulimits.nofile 部分

  • chown -R 1030:1030 获取所需的卷

这似乎是一个权限问题。

关于mysql - 无法在 Docker 上加载 Artifactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51390850/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com