Template
1
0

Controlling service with podman and systemd

This commit is contained in:
Azer Abdullaev 2021-02-03 18:27:45 +01:00
parent 0237f4bec4
commit 8f0ec476d2
2 changed files with 18 additions and 5 deletions

View File

@ -1,11 +1,14 @@
all: build
all: build deploy update
build: Makefile
podman build -t dummy:latest .
deploy:
docker service ps -q dummy || docker service create \
--name dummy \
dummy:latest
docker service rm dummy || true
install -D -m 644 config/systemd/dummy.service /etc/systemd/system
podman run --name dummy -d dummy:latest
systemctl daemon-reload
systemctl enable dummy.service
update:
docker service update --force dummy
systemctl --user restart dummy.service

View File

@ -0,0 +1,10 @@
[Unit]
Description=A dummy service
[Service]
Restart=always
ExecStart=/usr/bin/podman start -a dummy
ExecStop=/usr/bin/podman stop -t 2 dummy
[Install]
WantedBy=default.target