Docker部署ActiveMq

一、ActiveMq配置文件

1.网页用户访问密码

修改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。 此处是管理界面登录时的用户名和密码
在这里插入图片描述
用户名:密码,角色; 根据这个修改即可。修改完成后,重新启动,使用新的账号和密码即可登录成功。

2.设置订阅发布角色密码

文件在/conf/credentials.properties
在这里插入图片描述

二、Dockerfile配置

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 

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值