Run Netdata with podman and systemd

Quick snippet of code if you need netdata and want to manage it with a systemd service

mkdir -p /opt/netdata/{config,lib,cache}
chown 201:201 /opt/netdata -R

run -d --name=netdata \
  -p 19999:19999 \
  -v /opt/netdata/config:/etc/netdata \
  -v /opt/netdata/lib:/var/lib/netdata \
  -v /opt/netdata/cache:/var/cache/netdata \
  -v /etc/passwd:/host/etc/passwd:ro \
  -v /etc/group:/host/etc/group:ro \
  -v /proc:/host/proc:ro \
  -v /sys:/host/sys:ro \
  -v /etc/os-release:/host/etc/os-release:ro \
  --restart unless-stopped \
  --cap-add SYS_PTRACE \
  --security-opt apparmor=unconfined \
  netdata/netdata

podman generate systemd --name netdata --new > /etc/systemd/system/container-netdata.service
systemctl daemon-reload 
systemctl enable container-netdata.service
systemctl restart container-netdata.service

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *