Java 无法获取activemq Docker映像以在portainer中作为服务运行

Java 无法获取activemq Docker映像以在portainer中作为服务运行,java,docker,yaml,activemq,portainer,Java,Docker,Yaml,Activemq,Portainer,我有一个ActiveMQ Docker映像存储在本地Nexus存储库中 我正在尝试使用以下stack.yml将此映像中的ActiveMQ作为服务部署到Portainer实例上:- version: "3" networks: jon: services: activemq: image: nexus:21111/activemq:latest ports: - "15100:61616" volumes: - /jon/

我有一个ActiveMQ Docker映像存储在本地Nexus存储库中

我正在尝试使用以下stack.yml将此映像中的ActiveMQ作为服务部署到Portainer实例上:-

version: "3"
networks:
  jon:
services:          
  activemq:
    image: nexus:21111/activemq:latest
    ports:
      - "15100:61616"
    volumes:
      - /jon/test/activemq/data:/data/activemq
      - /jon/test/activemq/conf:/opt/activemq/conf
      - /jon/test/activemq/log:/var/log/activemq
    networks:
      - jon
    environment:
      ACTIVEMQ_ADMIN_LOGIN: xxxxx
      ACTIVEMQ_ADMIN_PASSWORD: xxxxx
      PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      ACTIVEMQ_CONFIG_DIR: /opt/activemq/conf
      ACTIVEMQ_DATA_DIR: /data/activemq
    deploy:
      placement:
        constraints:
          - node.labels.affinity == ${NODE}
      replicas: 1
      restart_policy:
        condition: on-failure
在部署这个stack.yml之前,我创建了volumes部分中指定的三个主机卷。我为所有用户设置了这些目录的完全读写权限

当我尝试在Portainer中部署yml文件时,会检索映像,并且容器的状态为“Running”。但是,当我检查日志时,我看到以下内容:-

2019-03-15 15:08:50,450 CRIT Supervisor running as root (no user in config file)
2019-03-15 15:08:50,450 WARN Included extra file "/etc/supervisor/conf.d/activemq.conf" during parsing
2019-03-15 15:08:50,450 WARN Included extra file "/etc/supervisor/conf.d/cron.conf" during parsing
2019-03-15 15:08:50,469 INFO RPC interface 'supervisor' initialized
2019-03-15 15:08:50,469 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2019-03-15 15:08:50,470 INFO supervisord started with pid 1
2019-03-15 15:08:51,473 INFO spawned: 'cron' with pid 16
2019-03-15 15:08:51,477 INFO spawned: 'activemq' with pid 17
2019-03-15 15:08:52,219 INFO exited: activemq (exit status 1; not expected)
2019-03-15 15:08:53,221 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-03-15 15:08:53,222 INFO spawned: 'activemq' with pid 87
2019-03-15 15:08:53,980 INFO exited: activemq (exit status 1; not expected)
2019-03-15 15:08:55,983 INFO spawned: 'activemq' with pid 158
2019-03-15 15:08:56,721 INFO exited: activemq (exit status 1; not expected)
2019-03-15 15:08:59,726 INFO spawned: 'activemq' with pid 229
2019-03-15 15:09:00,443 INFO exited: activemq (exit status 1; not expected)
2019-03-15 15:09:01,445 INFO gave up: activemq entered FATAL state, too many start retries too quickly
关联的错误消息粘贴在下面:-

Traceback (most recent call last):
  File "/app/entrypoint/Init.py", line 331, in <module>
    serviceRun.setting_all()
  File "/app/entrypoint/Init.py", line 256, in setting_all
    self.do_init_activemq()
  File "/app/entrypoint/Init.py", line 246, in do_init_activemq
    self.replace_all(ACTIVEMQ_CONF + "/log4j.properties", "\$\{activemq\.base\}\/data\/", "/var/log/activemq/")
  File "/app/entrypoint/Init.py", line 27, in replace_all
    f = open(file,'r')
IOError: [Errno 2] No such file or directory: '/opt/activemq/conf.tmp/log4j.properties'
回溯(最近一次呼叫最后一次):
文件“/app/entrypoint/Init.py”,第331行,在
serviceRun.setting_all()
文件“/app/entrypoint/Init.py”,第256行,在设置中
self.do_init_activemq()
do_Init_activemq中的文件“/app/entrypoint/Init.py”,第246行
self.replace\u all(ACTIVEMQ\u CONF+“/log4j.properties”、“\$\{ACTIVEMQ\.base\}\/data\/”、“/var/log/ACTIVEMQ/”)
文件“/app/entrypoint/Init.py”,第27行,全部替换
f=打开(文件,'r')
IOError:[Errno 2]没有这样的文件或目录:'/opt/activemq/conf.tmp/log4j.properties'
它提到了一个丢失的文件。事实上,当我查看绑定到
/opt/activemq/conf.tmp
/opt/activemq/conf
的主机卷时,它们中根本没有任何内容,尽管有一个文件
activemq.pid
确实会写入绑定到
/data/activemq
的主机卷


有没有人见过这种行为和/或对我可能出现的问题有什么建议?非常感谢阅读我的问题。

根据您发布的撰写文件,
/opt/activemq/conf.tmp
上没有绑定卷。@code站点谢谢,这是一个好位置。然而,当我为conf.tmp添加了一个额外的绑定并试图重新部署时,Init.py在其执行的早期抛出了一个错误:
文件/usr/lib/python2.7/os.py”,第157行,在makedirs mkdir(名称,模式)OSError:[Errno 17]文件存在:“/opt/activemq/conf.tmp”
,听起来与docker无关。您的容器正在尝试创建该目录,如果该目录已经存在,则会失败,因此目录创建不应该失败,或者该目录不应该存在,也不应该被装载。是的,同意。钥匙一定在那些底座上。当我使用我的原始帖子中的内容时,
conf.tmp
甚至没有被创建。当我为它添加一个额外的挂载时,我在第一条评论中得到了错误。有趣的是,当我再次删除它,然后简单地将挂载添加到“/opt/activemq”时,“conf.tmp”目录确实会被创建,但内容仍然为空,并且此错误导致
IOError:[Errno 2]没有这样的文件或目录:'/opt/activemq/bin/linux-x86-64/activemq'
。这有点让人畏缩,因为我是新手,但我会继续尝试!根据您发布的撰写文件,
/opt/activemq/conf.tmp
上没有绑定卷。@codestation谢谢,这是一个好位置。然而,当我为conf.tmp添加了一个额外的绑定并试图重新部署时,Init.py在其执行的早期抛出了一个错误:
文件/usr/lib/python2.7/os.py”,第157行,在makedirs mkdir(名称,模式)OSError:[Errno 17]文件存在:“/opt/activemq/conf.tmp”
,听起来与docker无关。您的容器正在尝试创建该目录,如果该目录已经存在,则会失败,因此目录创建不应该失败,或者该目录不应该存在,也不应该被装载。是的,同意。钥匙一定在那些底座上。当我使用我的原始帖子中的内容时,
conf.tmp
甚至没有被创建。当我为它添加一个额外的挂载时,我在第一条评论中得到了错误。有趣的是,当我再次删除它,然后简单地将挂载添加到“/opt/activemq”时,“conf.tmp”目录确实会被创建,但内容仍然为空,并且此错误导致
IOError:[Errno 2]没有这样的文件或目录:'/opt/activemq/bin/linux-x86-64/activemq'
。这有点让人畏缩,因为我是新手,但我会继续尝试!