Not able to access admin console for an activemq instance running in a docker container

て烟熏妆下的殇ゞ 提交于 2021-01-28 19:44:49

问题


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"]

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/

Neither of them works

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?


回答1:


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!

I fixed it by updating the jetty.xml

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

property name="host" value="127.0.0.1"

to

property name="host" value="0.0.0.0"

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



来源:https://stackoverflow.com/questions/63127321/not-able-to-access-admin-console-for-an-activemq-instance-running-in-a-docker-co

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!