0

我正在按照本指南在 Mac(Big Sur)上启动 DHIS2 的 docker 容器,并且核心容器一直在我身上重复,因为 Tomcatserver.xml不能被 chowned。这是日志的尾部:

  inflating: /usr/local/tomcat/webapps/ROOT/dhis-web-sms-configuration/safari-pinned-tab.svg  
  inflating: /usr/local/tomcat/webapps/ROOT/dhis-web-sms-configuration/package.json  
  inflating: /usr/local/tomcat/webapps/ROOT/dhis-web-sms-configuration/favicon.ico  
  inflating: /usr/local/tomcat/webapps/ROOT/dhis-web-sms-configuration/service-worker.js  
  inflating: /usr/local/tomcat/webapps/ROOT/dhis-web-sms-configuration/favicon-48x48.png  
  inflating: /usr/local/tomcat/webapps/ROOT/dhis-web-sms-configuration/manifest.webapp  
  inflating: /usr/local/tomcat/webapps/ROOT/META-INF/maven/org.hisp.dhis/dhis-web-portal/pom.xml
  inflating: /usr/local/tomcat/webapps/ROOT/META-INF/maven/org.hisp.dhis/dhis-web-portal/pom.properties  
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted
chown: changing ownership of '/usr/local/tomcat/conf/server.xml': Operation not permitted

这是docker-compose.yml文件:

version: '3'
services:
  core:
    image: "${DHIS2_CORE_IMAGE}"
    user: root
    restart: always
    volumes:
      - ${DHIS2_CORE_CONFIG:-./config/DHIS2_home/dhis.conf}:/DHIS2_home/dhis.conf
      - ./config/server.xml:/usr/local/tomcat/conf/server.xml
      - ./config/DHIS2_home:/DHIS2_home
    environment:
      CATALINA_OPTS: "-Dcontext.path='${DHIS2_CORE_CONTEXT_PATH:-}'"
    depends_on:
      - "db"
  db:
    image: "mdillon/postgis:10-alpine"
    command: "postgres -c max_locks_per_transaction=100"
    restart: always
    volumes:
      - datadb:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: dhis2
      POSTGRES_USER: dhis
      POSTGRES_PASSWORD: dhis
  gateway:
    image: "jwilder/nginx-proxy:alpine"
    restart: always
    ports:
      - "${DHIS2_CORE_PORT}:80"
    volumes:
      - ./config/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./.apps:/data/apps:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
volumes:
  datadb:
  home:

我在user: root那里添加了,但没有任何区别。随着容器重新启动,502 Bad Gateway当我尝试通过http://localhost:8080. 似乎膨胀文件的用户没有足够的权限对server.xml​​文件执行 chown。

有没有办法永久解决这个问题?是否有提升集群的方法或更改容器中用户的有效权限的方法?

4

1 回答 1

1

你所做的看起来不错。但是我不知道您正在使用的图像,并且他们对应该运行容器的用户有非常具体的看法:您可以尝试遵循它吗?

https://developers.dhis2.org/docs/tutorials/dhis2-docker

user:root 不工作的一个原因:(只是一个假设)他们用来创建映像的 Dockerfile 可能引用了一个入口点脚本,该脚本在运行 chown 之前将正在运行的用户更改为他们指南中的用户。

于 2021-11-08T22:06:43.340 回答