Controlling service with podman and systemd
This commit is contained in:
parent
0237f4bec4
commit
8f0ec476d2
13
Makefile
13
Makefile
|
@ -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
|
||||
|
|
10
config/systemd/dummy.service
Normal file
10
config/systemd/dummy.service
Normal 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
|
Loading…
Reference in New Issue
Block a user