# 指定jdk版本为官方openjdk8
FROM openjdk:8
# 挂载数据卷
VOLUME /tmp
# 指定jar包
ADD *.jar sentinel-dashboard-1.8.6.jar
# 设置时区
ENV TZ=Asia/Shanghai
RUN ls -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone
# 执行,开放端口
ENTRYPOINT ["java","-jar","-Dserver.port=8080","-Dcsp.sentinel.dashboard.server=127.0.0.0:8080","-Dproject.name=sentinel-dashboard","-Dsentinel.dashboard.auth.username=xiaozhang","-Dsentinel.dashboard.auth.password=xiaozhang","/sentinel-dashboard-1.8.6.jar"]
注意:
"-Dsentinel.dashboard.auth.username=xiaozhang"
:后面设置的是登录用户名,可以自定义"-Dsentinel.dashboard.auth.password=xiaozhang"
:这里是用户名对应的密码,自己设置即可"-Dcsp.sentinel.dashboard.server=127.0.0.0:8080"
:这里改为自己的虚拟机ip或者服务器ipdocker build -t sentinel-server .
如下所示:
docker images
docker run \
--name sentinel-server \
-p 8080:8080 \
--restart=always \
--privileged=true \
-d sentinel-server
docker ps