无法在Docker上加载Artifactory

时间:2018-07-17 22:07:44

标签: mysql docker artifactory

我无法让Artifactory在MySQL和Docker上工作。以下是我得到的错误。

我首先创建一个保存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所有者及其下的所有内容均已更改。唯一的例外是mysql连接器(/var/opt/jfrog/artifactory/tomcat/common/lib/mysql-connector-java-8.0.11.jar),该连接器保留根所有权。

# 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

1 个答案:

答案 0 :(得分:0)

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

  • 删除ulimits.nofile部分

  • chown -R 1030:1030 for your required volume

似乎是权限问题。