File size: 785 Bytes
2ef9ed5
 
d116509
2ef9ed5
 
 
f60cfc1
 
 
2ef9ed5
 
88eb29b
2ef9ed5
 
 
 
5b7621a
 
2ef9ed5
5b7621a
2ef9ed5
5b7621a
 
 
2ef9ed5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 使用 Ubuntu 作为基础镜像
FROM ubuntu:20.04

# 安装必要的软件
RUN apt-get update && apt-get install -y wget

# 修改目录权限
RUN mkdir -p prometheus && chmod -R 777 prometheus

# 下载 Prometheus
RUN wget https://github.com/prometheus/prometheus/releases/download/v2.43.0/prometheus-2.43.0.linux-amd64.tar.gz && \
    tar -xvzf prometheus-2.43.0.linux-amd64.tar.gz -C prometheus && \
    rm prometheus-2.43.0.linux-amd64.tar.gz

# 将 Prometheus 配置文件复制到容器中
COPY prometheus.yml /prometheus/prometheus.yml

# 设置工作目录
WORKDIR /prometheus/prometheus-2.43.0.linux-amd64

# 暴露 Prometheus 默认端口
EXPOSE 9090

# 启动 Prometheus
CMD ["./prometheus", "--config.file=/prometheus/prometheus.yml", "--storage.tsdb.path=/prometheus"]