阅读 63

docker-compose​搭建记录

docker-compose + dubbo-admin + zookeeper 搭建记录

环境

  • 服务器:阿里云
  • 系统:CentOS
  • docker version 18.09.4
  • docker-compose version 1.24.0
  • git version 2.19.1
  • maven version 3.6.0

zookeeper

docker pull zookeeper

dubbo-admin

cd workspace/
git clone https://github.com/apache/incubator-dubbo-admin.git
# 打开ops的页面自动跳转到了admin,可能已经修改了?
cd incubator-dubbo-admin/
git checkout master
cd dubbo-admin/
vim src/main/resources/application.properties
复制代码

修改application配置项 dubbo.registry.addresszookeeper://zookeeper:2181,后一个zookeeper对应后面docker-compose.yml中的links项zk_server的值

mvn clean package -Dmaven.test.skip=true
vim Dockerfile
复制代码

添加Dockerfile文件内容(作者信息请自行修改)

FROM openjdk:8-jdk-alpine
MAINTAINER magiklau.cn<MagikLau@Foxmail.com>
VOLUME /tmp
ADD ./target/dubbo-admin-0.0.1-SNAPSHOT.jar app.jar

ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
复制代码

装载镜像

docker build -t dubbo-admin:1.0 . # 别漏了这个点
复制代码

此时通过docker images可查看到新的镜像

[root@xxxxxx dubbo-admin]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
dubbo-admin         1.0                 cf5afba7ea98        4 minutes ago      136MB
复制代码

回到上级目录/root/workspace/incubator-dubbo-admin/并添加文件

vim docker-compose.yml
复制代码

增加内容

version: '3.4'
services:
  zk_server:
    image: zookeeper:3.4
    ports:
      - 2181:2181
    dubbo-admin:
      image: dubbo-admin:1.0
      links:
        - zk_server:zookeeper
      depends_on:
        - zk_server
      ports:
        - 7001:7001
复制代码

启动

docker-compose up
复制代码

打开网页http://ip:7001即可查看dubbo管理台,root/root登录

注意:云服务器需要开安全组添加7001端口才可访问

以上,docker-compose + dubbo-admin + zookeeper 的基本搭建已完成

——

如需部署zookeeper集群则可参考:www.jianshu.com/p/bcca50810…

关注下面的标签,发现更多相似文章
评论