首先登陆服务器之后有容器cadvisor就无限制重启报错
shitou@aishitou:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ab357e46450f grafana/grafana:latest "/run.sh" 5 months ago Up 2 days 0.0.0.0:3000->3000/tcp, [::]:3000->3000/tcp grafana
553e54dcef0d prom/prometheus:latest "/bin/prometheus --c…" 5 months ago Up 2 days 0.0.0.0:9090->9090/tcp, [::]:9090->9090/tcp prometheus
eec3a45791bc google/cadvisor:latest "/usr/bin/cadvisor -…" 5 months ago Restarting (255) 2 seconds ago shitou@aishitou:~/monitor$ cat docker-compose.yml
version: '3'
services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: always
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
ports:
- "9090:9090"
networks:
- monitor_net
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: always
environment:
- GF_DEFAULT_LANGUAGE=zh-CN # 强制中文界面
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning # 预配置目录
ports:
- "3000:3000"
networks:
- monitor_net
depends_on:
- prometheus
cadvisor:
image: docker.io/google/cadvisor:latest
container_name: cadvisor
restart: always
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
ports:
- "8080:8080"
networks:
- monitor_net
volumes:
prometheus_data:
grafana_data:
networks:
monitor_net:
driver: bridge
shitou@aishitou:~/monitor$ cat
docker-compose.yml grafana/ prometheus.yml
shitou@aishitou:~/monitor$ cat prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['prometheus:9090'] # 直接使用容器名访问
- job_name: 'cadvisor'
static_configs:
- targets: ['cadvisor:8080'] # 直接使用容器名访问shitou@aishitou:~/monitor$ cat docker-compose.yml
version: '3'
services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: always
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
ports:
- "9090:9090"
networks:
- monitor_net
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: always
environment:
- GF_DEFAULT_LANGUAGE=zh-CN # 强制中文界面
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning # 预配置目录
ports:
- "3000:3000"
networks:
- monitor_net
depends_on:
- prometheus
cadvisor:
image: docker.io/google/cadvisor:latest
container_name: cadvisor
restart: always
privileged: true
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/kmsg:/dev/kmsg:ro
ports:
- "8080:8080"
networks:
- monitor_net
cap_add: # 新增:赋予访问内核日志的权限
- SYSLOG
volumes:
prometheus_data:
grafana_data:
networks:
monitor_net:
driver: bridge


shitou@aishitou:~/monitor$ sudo cp /etc/fstab /etc/fstab.v1
shitou@aishitou:~/monitor$ sudo rm /etc/fstab
shitou@aishitou:~/monitor$ sudo cp /etc/fstab.
fstab.bf fstab.v1
shitou@aishitou:~/monitor$ sudo cp /etc/fstab.bf /etc/fstab
shitou@aishitou:~/monitor$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/975f86b3-b8ea-4365-902d-5c61c0ad749c / ext4 defaults 0 1
# /boot was on /dev/sda3 during curtin installation
/dev/disk/by-uuid/069c7f52-682b-45f4-8c2e-2f2f38f9c60a /boot ext4 defaults 0 1
/dev/disk/by-uuid/8b865cd9-1d8f-48e5-bfe6-6a649909b853 none swap sw 0 0
# /boot/efi was on /dev/sda1 during curtin installation
/dev/disk/by-uuid/2D20-0B2E /boot/efi vfat defaults 0 1
shitou@aishitou:~/monitor$ cat /etc/fstab.
fstab.bf fstab.v1
shitou@aishitou:~/monitor$ cat /etc/fstab.v1
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/975f86b3-b8ea-4365-902d-5c61c0ad749c / ext4 defaults 0 1
# /boot was on /dev/sda3 during curtin installation
/dev/disk/by-uuid/069c7f52-682b-45f4-8c2e-2f2f38f9c60a /boot ext4 defaults 0 1
/dev/disk/by-uuid/8b865cd9-1d8f-48e5-bfe6-6a649909b853 none swap sw 0 0
# /boot/efi was on /dev/sda1 during curtin installation
/dev/disk/by-uuid/2D20-0B2E /boot/efi vfat defaults 0 1
none /sys/fs/cgroup/cpu cgroup defaults,cpu,cpuacct 0 0
修改为v2,
shitou@aishitou:~/monitor$ cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
# If your computer has multiple operating systems installed, then you
# probably want to run os-prober. However, if your computer is a host
# for guest OSes installed via LVM or raw disk devices, running
# os-prober can cause damage to those guest OSes as it mounts
# filesystems to look for things.
#GRUB_DISABLE_OS_PROBER=false
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
原创
普罗米修斯docker 部署后遇见的问题
本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。
评论交流
欢迎留下你的想法