2023-03-01 13:18:25 +00:00
|
|
|
#
|
|
|
|
# Example systemd service file for running container
|
|
|
|
#
|
2023-03-02 06:41:32 +00:00
|
|
|
# Image needs to be build/available locally.
|
|
|
|
#
|
2023-03-01 13:18:25 +00:00
|
|
|
# Install into /etc/systemd/system/docker-hellomicronaut.service
|
|
|
|
# systemctl daemon-reload
|
|
|
|
# systemctl enable docker-hellomicronaut.service
|
|
|
|
# systemctl start docker-hellomicronaut.service
|
|
|
|
#
|
|
|
|
|
|
|
|
[Unit]
|
|
|
|
Description=Hellomicronaut Container
|
|
|
|
After=docker.service
|
|
|
|
Requires=docker.service
|
|
|
|
User=nobody
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
TimeoutStartSec=0
|
|
|
|
Restart=always
|
|
|
|
ExecStartPre=-/usr/bin/docker stop %n
|
|
|
|
#ExecStartPre=-/usr/bin/docker rm %n
|
|
|
|
#ExecStartPre=/usr/bin/docker pull redis
|
|
|
|
ExecStart=/usr/bin/docker run --rm --name %n --publish 8080:8080 hellomicronaut
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|