1.9 KiB
1.9 KiB
Container
Use podman
or docker
:
podman run registry.philo.ydns.eu/philo/sms-handler
Parameters are given as environment variables, eg.:
podman run -e SMS_HANDLER_MAIL_SERVER_PORT=8025 -e SMS_HANDLER_MAIL_SENDER=snoopy@peanuts.com SMS_HANDLER_MAIL_TO=snoopy@peanuts.com registry.philo.ydns.eu/philo/sms-handler
Container as a systemd service
Systemd can "orchestrate" containers easily thanks to podman.
Rootless (as regular user)
For a rootless container, create a file in .config/containers/systemd/sms-handler.container
.
The configuration is given as environment variables (email addresses snoopy@peanuts.com
in this example):
[Container]
ContainerName=sms-handler
Environment=SMS_HANDLER_MAIL_SENDER=snoopy@peanuts.com
Environment=SMS_HANDLER_MAIL_TO=snoopy@peanuts.com
Image=registry.philo.ydns.eu/philo/sms-handler
Network=podman
PublishPort=8025:8025
[Service]
Restart=always
[Install]
WantedBy=default.target
Request systemd to reload configuration, creating the service for this container:
systemctl --user daemon-reload
Start the container as a service:
systemctl start sms-handler.service
To start rootless containers at boot time, without the need for the user (snoopy) to log in:
sudo loginctl enable-linger snoopy
Rootful (as root)
For a rootless container, create a file in /etc/containers/systemd/sms-handler.container
:
[Container]
ContainerName=sms-handler
Environment=SMS_HANDLER_MAIL_SENDER=snoopy@peanuts.com
Environment=SMS_HANDLER_MAIL_TO=snoopy@peanuts.com
Image=registry.philo.ydns.eu/philo/sms-handler
Network=podman
PublishPort=8025:8025
[Service]
Restart=always
[Install]
WantedBy=default.target
Request systemd to reload configuration, creating the service for this container:
sudo systemctl daemon-reload
Start the container as a service:
sudo systemctl start sms-handler.service