1. 编写Dockerfile

  1. mkdir -p /root/docker/azkaban
  2. cd /root/docker/azkaban
  3. vi azkaban.Dockerfile

内容如下:

  1. FROM openjdk:8u212-jdk
  2. MAINTAINER polaris "450733605@qq.com"
  3. WORKDIR /opt/
  4. ADD azkaban-3.91.0-solo-server.fix.build.tar /opt/
  5. WORKDIR /opt/azkaban-solo-server
  6. RUN chmod +x bin/*.sh
  7. EXPOSE 8443 8081 5005
  8. CMD sh bin/start-solo.sh && tail -f /dev/null

注意:Azkaban运行需要JDK而不是JRE。

2. 构建镜像

  1. sudo docker build -f azkaban.Dockerfile -t azkaban-solo:v3.91.0 .
  2. # 镜像大小:532MB
  3. sudo docker images | grep azkaban-solo
  4. sudo docker rmi azkaban-solo:v3.91.0

3. 启动容器

  1. sudo docker run -itd --name azkaban -p 8181:8081 azkaban-solo:v3.91.0
  2. sudo docker ps |grep azkaban
  3. sudo docker start azkaban
  4. sudo docker restart azkaban
  5. sudo docker stop azkaban
  6. sudo docker rm azkaban

4. 验证

Web UI:http://192.168.216.100:8181
账户口令:azkaban/azkaban

5. 停止容器

  1. sudo docker exec -it azkaban /bin/bash
  2. cd /opt/azkaban-solo-server
  3. # 启动
  4. ./bin/start-solo.sh
  5. # 停止(方式1,容器内执行)
  6. ./bin/shutdown-solo.sh
  7. # 停止(方式2,无需进入容器)
  8. sudo docker exec -it azkaban /bin/bash /opt/azkaban-solo-server/bin/shutdown-solo.sh

6. 备份

  1. # 导出镜像(镜像:532MB,压缩包:520MB)
  2. sudo docker save -o docker-azkaban-3.91.0-pure.save.tar azkaban-solo:v3.91.0
  3. sudo docker save > docker-azkaban-3.91.0-pure.save.tar azkaban-solo:v3.91.0
  4. # 加载镜像
  5. sudo docker load -i docker-azkaban-3.91.0-pure.save.tar
  6. sudo docker load < docker-azkaban-3.91.0-pure.save.tar
  7. # 运行容器
  8. sudo docker run -itd --name azkaban -p 8181:8081 azkaban-solo:v3.91.0

参考

CSDN:Docker构建学习环境(4)-Azkaban Solo模式调度Spark
https://blog.csdn.net/houwanfeimark/article/details/106063830