问题
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