1. 编写Dockerfile
mkdir -p /root/docker/azkaban
cd /root/docker/azkaban
vi azkaban.Dockerfile
内容如下:
FROM openjdk:8u212-jdk
MAINTAINER polaris "450733605@qq.com"
WORKDIR /opt/
ADD azkaban-3.91.0-solo-server.fix.build.tar /opt/
WORKDIR /opt/azkaban-solo-server
RUN chmod +x bin/*.sh
EXPOSE 8443 8081 5005
CMD sh bin/start-solo.sh && tail -f /dev/null
2. 构建镜像
sudo docker build -f azkaban.Dockerfile -t azkaban-solo:v3.91.0 .
# 镜像大小:532MB
sudo docker images | grep azkaban-solo
sudo docker rmi azkaban-solo:v3.91.0
3. 启动容器
sudo docker run -itd --name azkaban -p 8181:8081 azkaban-solo:v3.91.0
sudo docker ps |grep azkaban
sudo docker start azkaban
sudo docker restart azkaban
sudo docker stop azkaban
sudo docker rm azkaban
4. 验证
Web UI:http://192.168.216.100:8181
账户口令:azkaban/azkaban
5. 停止容器
sudo docker exec -it azkaban /bin/bash
cd /opt/azkaban-solo-server
# 启动
./bin/start-solo.sh
# 停止(方式1,容器内执行)
./bin/shutdown-solo.sh
# 停止(方式2,无需进入容器)
sudo docker exec -it azkaban /bin/bash /opt/azkaban-solo-server/bin/shutdown-solo.sh
6. 备份
# 导出镜像(镜像:532MB,压缩包:520MB)
sudo docker save -o docker-azkaban-3.91.0-pure.save.tar azkaban-solo:v3.91.0
sudo docker save > docker-azkaban-3.91.0-pure.save.tar azkaban-solo:v3.91.0
# 加载镜像
sudo docker load -i docker-azkaban-3.91.0-pure.save.tar
sudo docker load < docker-azkaban-3.91.0-pure.save.tar
# 运行容器
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