本文介绍了无法访问在Docker容器中运行的activemq实例的管理控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了dockerfile.

I have created dockerfile.

FROM ubuntu:latest

RUN apt-get update && apt-get -y upgrade
RUN apt-get -y install curl
RUN apt-get -y install default-jre

RUN curl -O http://archive.apache.org/dist/activemq/5.16.0/apache-activemq-5.16.0-bin.tar.gz
RUN mkdir -p /opt/apache/activemq
RUN tar xvzf apache-activemq-5.16.0-bin.tar.gz -C /opt/apache/activemq

WORKDIR /opt/apache/activemq/apache-activemq-5.16.0/bin
VOLUME /opt/apache/activemq/apache-activemq-5.16.0/conf

RUN echo './activemq start && tail -f /opt/apache/activemq/apache-activemq-5.16.0/data/activemq.log' > start.sh

# Admin interface
EXPOSE 8161
# Active MQ's default port (Listen port)
EXPOSE 61616

CMD ["/bin/bash", "./start.sh"]

我创建了一个像这样的docker容器

I created a docker container like this

docker run --name activemq -p 8161:8161 -p 61616:61616 temp-activemq:5.16.0

我尝试如下运行管理控制台

I tried to run the admin console as follows

http:://localhost:8161/admin/
http://<IP of the Container>:8161/admin/

它们都不起作用

在容器之外,我安装了activeMQ并尝试运行管理控制台,它起作用了.谁能帮我找到有关如何排序的指针吗?

Outside of the container, I installed activeMQ and tried to run admin console, it worked. Can anyone please help me with pointers on how can I get this sorted?

我通过以下方式解决了上述问题

I fixed the above issue with

docker run --rm -d --network host --name activemq temp-activemq:5.16.0

但是,我仍在研究为什么端口转发不起作用?

But, I am still researching why the port forwarding is not working?

推荐答案

我遇到了同样的问题.在AMQ 5.16.0中,他们已将Web UI的jetty.xml更新为使用127.0.0.1而不是0.0.0.0!

I had the same issue. In AMQ 5.16.0 they've updated the jetty.xml for the web UI to use 127.0.0.1 instead of 0.0.0.0!

我通过更新jetty.xml修复了它

I fixed it by updating the jetty.xml

在"org.apache.activemq.web.WebConsolePort"下更新在jetty.xml中->

update under "org.apache.activemq.web.WebConsolePort" in jetty.xml -->

property name="host" value="127.0.0.1"

property name="host" value="0.0.0.0"

您需要在Docker映像中复制并覆盖此文件,它应该可以工作.

You'll need to copy and overwrite this file in your docker image and it should work.

这篇关于无法访问在Docker容器中运行的activemq实例的管理控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 07:00