一、创建文件夹
mkdir -p /docker/alibaba/sentinel/{config,data,logs}
二、拷贝jar包进sentinel目录下
三、Dockerfile文件
FROM openjdk:8-jre
MAINTAINER yh
COPY ./sentinel-dashboard.jar /app.jar
EXPOSE 8718
ENTRYPOINT ["java", "-jar", "app.jar"]
四、docker-compose.yml
version: '3.9'
services:
sentinel:
build:
context: ./
dockerfile: ./Dockerfile
image: sentinel
container_name: sentinel
ports:
- "8718:8718"
environment:
JVM_OPTS: -server -Xmx512M -Xms512M -XX:MaxMetaspaceSize=256M -XX:CompressedClassSpaceSize=50M -XX:ReservedCodeCacheSize=240M -XX:MaxDirectMemorySize=400M
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "1"
volumes:
- "/docker/alibaba/sentinel/logs:/root/logs"
- "/docker/alibaba/sentinel/logs:/app-logs"
command: [
"--server.port=8718",
"--logging.file.path=/app-logs"
]
restart: always
network_mode: "host"
五、启动
docker-compose up -d
六、防火墙开放8718端口
firewall-cmd --permanent --add-port=8718/tcp
# 防火墙重载
firewall-cmd --reload
七、访问验证
http://172.50.2.40:8718/