Docker:SLF4J-Error with Docker + Confluence-Server + MySQL - "docker run" 有效,"docker-compose up" 无效

Docker: SLF4J-Error with Docker + Confluence-Server + MySQL - "docker run" works, "docker-compose up" not

我正在尝试 运行 与 mysql 融合 Docker Desktop on Windows 10 在使用 docker-compose.yml 文件的多容器应用程序中像这样:

services: 
  confluence:
    image: atlassian/confluence-server:7.4.6
    build: ./confluence
    container_name: confluence
    hostname: confluence
    volumes: 
      - ./confluence/data/confluence:/var/atlassian/application-data/confluence   # for the confluence.cfg.xml
      - ./confluence/lib:/opt/atlassian/confluence/confluence/WEB-INF/lib   # for the mysql driver jar-file
    ports:
      - 8090:8090
      - 8091:8091

  mysql:
    image: mysql:5.7
    build: ./mysql
    container_name: mysql
    hostname: mysql
    ports:
      - 3306:3306
    environment: 
      - MYSQL_ROOT_PASSWORD=root
    command: [mysqld, --character-set-server=utf8, --collation-server=utf8_bin, --default-storage-engine=INNODB, --max_allowed_packet=256M, --innodb_log_file_size=2GB, --transaction-isolation=READ-COMMITTED, --binlog_format=row]

然而,当我 运行 这个与 docker-compose up --build --force-recreate 我得到

INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.33] confluence | Handler error confluence | java.lang.ClassNotFoundException: org.slf4j.bridge.SLF4JBridgeHandler confluence | at ... at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) confluence | at java.base/java.lang.Thread.run(Thread.java:834) confluence | SEVERE [Catalina-utility-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file confluence | SEVERE [Catalina-utility-1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors confluence | INFO [Catalina-utility-2] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. confluence | SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". confluence | SLF4J: Defaulting to no-operation (NOP) logger implementation confluence | SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

当我运行docker run -v d:/docker/conf-mysql/confluence/data/confluence:/var/atlassian/application-data/confluence --name="confluence" -p 8090:8090 -p 8091:8091 atlassian/confluence-server:7.4.6我得到

INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.33] INFO [Catalina-utility-2] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

所以:在这两种情况下,SLF4J 都会退回到 NOP 模式,但是当我使用 docker-compose up 时,我得到了一个严重的错误,并且在 localhost:8090 上出现了 404,因为 Tomcat 无法加载 SLF4J当我使用 docker run 时,confluence 在 URI 上启动,但随后没有可连接的 DBMS。

有什么想法吗?请帮忙!谢谢!

好的,这很简单: 我只需要删除行

  • ./confluence/lib:/opt/atlassian/confluence/confluence/WEB-INF/lib

我最初的理解是像这样绑定到容器的文件将被添加到文件夹并通过文件夹访问(就像 link )。 显然“卷”将整个路径重新路由到主机,如果容器文件夹中有文件,则无法再访问它们,而卷已绑定到容器。

希望这对某人有所帮助! :-)