docker部署grafana

复制文件

创建数据目录

# mkdir conf grafana

运行grafana

# docker run --rm -ti --name grafana grafana/grafana-oss:9.5.1-ubuntu

复制grafana.ini

# docker cp grafana:/etc/grafana/grafana.ini ./conf

设置目录权限

# chown -R 472 conf/ grafana/

docker-compose.yaml

version: '3.9'

services:
  grafana:
    image: grafana/grafana-oss:9.5.1-ubuntu
    container_name: grafana
    ports:
      - "3000:3000"
    environment:
      - TZ=Asia/Shanghai
    networks:
      - grafana
    volumes:
      - ./grafana:/var/lib/grafana
      - ./conf:/etc/grafana/

networks:
  grafana:
    driver: bridge

运行grafana

# docker-compose up -d
[+] Running 2/2
 ✔ Network grafana_grafana  Created                                                                                                                                                                                                                                                         0.1s 
 ✔ Container grafana        Started             

查看grafana

# docker ps
CONTAINER ID   IMAGE                              COMMAND                  CREATED         STATUS                 PORTS                                  NAMES
4d19131846fb   grafana/grafana-oss:9.5.1-ubuntu   "/run.sh"                2 seconds ago   Up 1 second            0.0.0.0:3000->3000/tcp                 grafana
posted @ 2023-05-10 15:38  小吉猫  阅读(675)  评论(0编辑  收藏  举报