Docker环境下ActiveMQ安装、连接
一、搜索activemq镜像
# 搜索activemq镜像
docker search activemq
[root@chushiyan ~]# docker search activemq
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/webcenter/activemq ActiveMQ 5.14.3 with OpenJDK-jre-8-headles... 172 [OK]
docker.io docker.io/rmohr/activemq Various versions of ActiveMQ neatly packet... 107 [OK]
docker.io docker.io/vromero/activemq-artemis ActiveMQ Artemis image (Debian and Alpine ... 23 [OK]
docker.io docker.io/cloudesire/activemq Latest activemq 4 [OK]
docker.io docker.io/andreptb/activemq Debian Jessie based image with ActiveMQ in... 3 [OK]
docker.io docker.io/aterreno/activemq-dockerfile 3 [OK]
docker.io docker.io/antonw/activemq-jmx ActiveMQ with (remote) JMX 1 [OK]
docker.io docker.io/ddmlu/activemq-openshift Fork of ayannah/activemq for openShift 1 [OK]
docker.io docker.io/jtech/activemq Latest ActiveMQ production distribution on... 1 [OK]
docker.io docker.io/spacetimeinsight/activemq activemq 1
docker.io docker.io/tremolosecurity/activemq-docker Hardened version of ActiveMQ for use with ... 1 [OK]
docker.io docker.io/albertonavarro/activemq12s 0
docker.io docker.io/aomitech/activemq-client 0
docker.io docker.io/aungzy/activemq Docker image for ActiveMQ, forked from htt... 0 [OK]
docker.io docker.io/ayannah/activemq Dockerized ActiveMQ 0 [OK]
docker.io docker.io/beeyond/activemq ActiveMQ MySQL 0
docker.io docker.io/bgbilling/activemq Apache ActiveMQ 0 [OK]
docker.io docker.io/camptocamp/activemq-mcollective Activemq image for mcollective 0 [OK]
docker.io docker.io/cloudunit/activemq-5.13 activemq-5.13 0 [OK]
docker.io docker.io/duffqiu/activemq-edge 0 [OK]
docker.io docker.io/duffqiu/activemq-hub 0 [OK]
docker.io docker.io/joakimgreenbird/activemq-bridge Bridge from kafka to activemq. 0
docker.io docker.io/kibiluzbad/activemq-artemis-operator ActiveMQ Artemis Operator 0
docker.io docker.io/larrytalley/activemq-docker-deployable Deployable instance of Apache ActiveMQ ins... 0 [OK]
docker.io docker.io/smaject/activemq Apache ActiveMQ based on CentOS 7 0 [OK]
二、安装运行activemq容器
没有官方的activemq镜像(OFFICIAL显示[OK]即是官方 ),所以这里安装STARS最多的:
docker run -di --name=my_activemq \
-p 61616:61616 \
-p 8161:8161 \
webcenter/activemq
参数说明:
参数 | 描述 |
---|---|
-d, --detach | Run container in background and print container ID(后台运行容器,并且打印容器id) |
-i, --interactive | Keep STDIN open even if not attached(保持标准输入,即使没有连上容器) |
–name string | Assign a name to the container(给容器指定名称) |
-p, --publish list | Publish a container’s port(s) to the host (default [])(将容器的端口映射到宿主机的端口上,可以映射多个端口) |
三、开放端口:
# 开放端口
iptables -I INPUT -p tcp -m tcp --dport 61616 -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 61616 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 8161 -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 8161 -j ACCEPT
iptables-save
如果是阿里云、亚马逊云主机等还得在防火墙放行。
四、访问后台界面
访问
http://192.168.0.1:8161/admin/
输入默认的admin/admin账号密码即可