#freshhell

  • Generate systemd unit-file for mqtt-broker
podman generate systemd -f -n mqtt-broker
/root/container-mqtt-broker.service
  • Copy the unit-file to the systemd search folder
cp container-mqtt-broker.service /etc/systemd/system/
  • Reload systemd
sudo systemctl daemon-reload
  • Start Container
systemctl enable --now container-mqtt-broker.service
Unit container-mqtt-broker.service could not be found.

Uh-oh, unit cannot be found!

  • Examine the selinux context for the file we generated
ls -lhZ /etc/systemd/system/container*
-rw-r--r--. 1 root root unconfined_u:object_r:systemd_unit_file_t:s0 685 Oct  5 10:35 /etc/systemd/system/container-ghost-blog-v3.service
-rw-r--r--. 1 root root unconfined_u:object_r:admin_home_t:s0        675 Dec 28 16:47 /etc/systemd/system/container-mqtt-broker.service

Note the context is: object_r:admin_home_t

  • Set the context to the same as the other unit-files
chcon -R -t systemd_unit_file_t /etc/systemd/system/container-mqtt-broker.service
  • Start the service

SELINUX