本文最后更新于 2024年12月2日 晚上
制作镜像
准备Dockerfile制作镜像sentinel-dashboard:latest
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| FROM maven:3.8-openjdk-8-slim as build WORKDIR /app COPY settings.xml /app/settings.xml RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \ sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \ apt-get update && \ apt-get upgrade -y && \ apt-get install -y git && \ git clone https://github.com/alibaba/Sentinel.git && \ cd Sentinel/sentinel-dashboard && \ /usr/share/maven/bin/mvn -s /app/settings.xml clean package -Dmaven.test.skip=true && \ cp target/sentinel-dashboard.jar /app/sentinel-dashboard.jar
FROM ccr.ccs.tencentyun.com/fenston/openjdk:8-jdk-slim ENV sentinel_home /home/sentinel WORKDIR $sentinel_home COPY --from=build /app/sentinel-dashboard.jar $sentinel_home/sentinel-dashboard.jar RUN chmod -R +x $sentinel_home/sentinel-dashboard.jar EXPOSE 8088 ENTRYPOINT ["/bin/sh", "-c", "java -jar $sentinel_home/sentinel-dashboard.jar --server.port=8088"]
|
使用打包命令:
1
| docker build -t sentinel-dashboard:latest .
|
创建 docker-compose.yml
创建文件: /usr/local/nacos/docker-compose.yml
, 内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| version: '3.1' services: sentinel: restart: always image: ccr.ccs.tencentyun.com/fenston/sentinel-dashboard:1.8.4 hostname: vm-sentinel container_name: sentinel environment: TZ: Asia/Shanghai LANG: en_US.UTF-8 volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro ports: - 8088:8088
|
启动镜像: