修改conf/activemq.xml,在 broker 标签下,找到 shutdownHooks标签。在这个标签后面添加以下内容。
<!-- destroy the spring context on shutdown to stop jetty -->
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
</shutdownHooks>
<!-- add plugins -->
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="${activemq.username}" password="${activemq.password}" groups="users,admins"/>
</users>
</simpleAuthenticationPlugin>
</plugins>
</broker>
修改conf/jetty.xml 修改 authenticate 修改成true(一般是默认true的)

然后打开conf/jetty-realm.properties。 此处是管理界面登录时的用户名和密码

用户名:密码,角色; 根据这个修改即可。修改完成后,重新启动,使用新的账号和密码即可登录成功。
文件在/conf/credentials.properties

Dockefile
# 获取镜像文件
FROM docker.io/webcenter/activemq
#配置文件 注意以下文件需在同级目录下
ADD activemq.xml /opt/activemq/conf/activemq.xml
ADD credentials.properties /opt/activemq/conf/credentials.properties
ADD jetty-realm.properties /opt/activemq/conf/jetty-realm.properties
进入docker 容器:docker exec -it activemq sh
查看刚刚进入的目录: pwd
start.sh
#!/bin/bash
#查询镜像
#docker search activemq
#取start最多的镜像
#docker pull docker.io/webcenter/activemq
docker build -t docker.io/webcenter/activemq:latest .
docker stop activemq | true
docker rm activemq | true
#启动镜像容器
docker run --network parking-net --network-alias activemq --restart always -p 61616:61616 -p 8161:8161 -d --name activemq docker.io/webcenter/activemq
