我在Ubuntu上测试了我的ApachedMQ图像,它与Docker一起工作正常。 在Openshift上部署相同的图像不起作用。 它应该开箱即用,就像Ubuntu一样,但它总是抱怨pod中缺少目录,或者对pod中的目录缺乏权限。您将在下面看到有关前者的错误。
我使用的是免费版的Openshift online v3.x 我只使用控制台从映像部署。 下面是pod正在进行部署时的日志消息示例。
java.io.FileNotFoundException: /opt/activemq/data/activemq.log (Permission denied)
Caused by: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
任何帮助都会非常感激,因为这个图像应该是IMO,可以从控制台部署,而不需要任何YAML和oc CLI。
一些日志跟踪信息:
INFO: Loading '/opt/activemq/bin/env'
INFO: Using java '/docker-java-home/jre/bin/java'
INFO: Starting in foreground, this is just for debugging purposes (stop process by pressing CTRL+C)
INFO: Creating pidfile /opt/activemq/data/activemq.pid
bin/activemq: 484: bin/activemq: cannot create /opt/activemq/data/activemq.pid: Permission denied
Java Runtime: Oracle Corporation 1.8.0_141 /usr/lib/jvm/java-8-openjdk-amd64/jre
Heap sizes: current=62976k free=58714k max=932352k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/activemq/conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/opt/activemq/tmp -Dactivemq.classpath=/opt/activemq/conf:/opt/activemq/../lib/: -Dactivemq.home=/opt/activemq -Dactivemq.base=/opt/activemq -Dactivemq.conf=/opt/activemq/conf -Dactivemq.data=/opt/activemq/data
Extensions classpath:
[/opt/activemq/lib,/opt/activemq/lib/camel,/opt/activemq/lib/optional,/opt/activemq/lib/web,/opt/activemq/lib/extra]
ACTIVEMQ_HOME: /opt/activemq
ACTIVEMQ_BASE: /opt/activemq
ACTIVEMQ_CONF: /opt/activemq/conf
ACTIVEMQ_DATA: /opt/activemq/data
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /opt/activemq/data/activemq.log (Permission denied)
...
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /opt/activemq/data/audit.log (Permission denied)
...
Loading message broker from: xbean:activemq.xml
INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@5bcab519: startup date [Fri Mar 16 21:10:18 UTC 2018]; root of context hierarchy
WARN | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
ERROR | Failed to load: class path resource [activemq.xml], reason: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
答案 0 :(得分:0)
为了成功部署映像,必须在集群上完成以下操作:
答案 1 :(得分:0)
我纠正了图像。 docker文件可以在我的fork上找到: https://github.com/beezerbt/docker-activemq/tree/master/5.14.5-openshift-v3.9.14
上面的图片可以在这里找到: https://hub.docker.com/r/beezer/openshift-ready-mq/tags/ 标签:: [5.14.5-3.9.14]
最后,由于图像具有短暂的持久性,因此可以非常轻松地将卷映射到openshift集群中的/app
;但请记住,您必须将卷装入点设置为除/ app之外的其他内容,然后在Openshift控制台上的卷定义中进一步向下,指定容器中应该映射到的位置...然后是/app.
答案 2 :(得分:0)
我创建了一个可以在 Openshift 中部署的 activemq 镜像 https://hub.docker.com/r/rangareddyv/activemq-openshift
使用最新版本的 activemq 和 amzn-corretto-jdk-11 创建一个镜像作为基础镜像,因为 openjdk 有很多 CVE 并且 alpine 不支持 jdk-11