Per the Grafana web-site, Grafana OSS lets you visualize your data and optimize your performance. You can easily collect, correlate, and visualize data with beautiful dashboards using Grafana — the open source data visualization and monitoring solution that drives informed decisions, enhances system performance, and streamlines troubleshooting.
The Grafana web-site provides instructions for deploying Grafana in a container on Docker, but nothing for deploying on Podman. These instructions are how I was finally able to successfully deploy running rootless Podman.
Note: I know, I know, you really should login in as a user account and use sudo for running most of these commands. However, since this is a lab, I prefer to take a shortcut. You do you.
Create the user, user directory, and assign a password
useradd -c "Grafana container account" -m grafana
password grafana <-- type your password
loginctl enable-linger grafana
Login, locate and download the container image
machinectl shell grafana@
podman search grafana
podman pull grafana/grafana:latest
podman create --name grafana docker.io/grafana/grafana:latest
Create the directories to save your data and populate the configuration file
mkdir -p /home/grafana/container/var/lib/grafana
mkdir -p /home/grafana/container/etc/grafana
wget -P /home/grafana/container/etc/grafana -O grafana.ini /https://github.com/grafana/grafana/blob/main/conf/sample.ini
Create the systemd service directory and file
mkdir -p /home/grafana/.config/systemd/user
cd /home/grafana/.config/systemd/user
podman generate systemd --files --new --name --start-timeout=60 grafana
Note: yes, I know that podman generate systemd is deprecated in favor of quadlets. As soon as podman releases a generate quadlet command, or I figure out how to perform a 1:1 mapping of systemd to quadlet files, I will migrate to using quadlets. Until then, if it ain’t broken don’t fix it.
Edit the systemd service file
vim container-grafana.service
The updated file should look like the following:
ExecStart=/usr/bin/podman run \
--cidfile=%t/%n.ctr-id \
--cgroups=no-conmon \
--label "io.containers.autoupdate=registry" \
--publish 3000:3000/tcp \
--volume /home/grafana/container/var/lib/grafana:/var/lib/grafana:Z,U \
--volume /home/grafana/container/etc/grafana:/etc/grafana:Z,U \
--hostname yourhostname.yourdomain \
--rm \
--sdnotify=conmon \
--detach \
--replace \
--name grafana \
docker.io/grafana/grafana
Configure the service to start automatically
systemctl --user daemon-reload
systemctl --user enable --now container-grafana
systemctl --user status container-grafana
Verify the service started and perform initial login / configuration
podman ps -f name=grafana
You should see output similar to the following:0c002eddb710 docker.io/grafana/grafana:latest 2 hours ago Up 2 hours 0.0.0.0:3000->3000/tcp grafana
Open a browser to http://hostname:3000
The default credentials areID=admin, PW=admin
That’s it. Feel free to leave a comment below.