mirror of
https://github.com/Brandon-Rozek/website.git
synced 2024-11-09 10:40:34 -05:00
New post
This commit is contained in:
parent
a24c90d593
commit
a9c0296b72
1 changed files with 31 additions and 0 deletions
31
content/blog/auto-updating-podman-containers.md
Normal file
31
content/blog/auto-updating-podman-containers.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
title: "Automatically Updating Podman Containers"
|
||||
date: 2022-05-15T22:20:47-04:00
|
||||
draft: false
|
||||
tags: []
|
||||
math: false
|
||||
---
|
||||
|
||||
Recently, I have been [transitioning to Podman](/blog/rootless-docker-compose-podman) for running my container infrastructure. In the process, I brought over Watchtower which I have previously used for auto-updating docker containers. Before doing so, I didn't check its [compatibility](https://github.com/containrrr/watchtower/issues/1060) (whoops) and found a few of my containers would every other week or so not come back up.
|
||||
|
||||
I then remembered that I restart my server for general system updates almost every day. What if I perform the podman container updates on start up? After modiyfing my systemd service to include an extra field called `ExecStartPre` and removing Watchtower, I found no more missing containers! The field `ExecStartPre` performs a pull (update) before starting up the containers via `ExecStart`.
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Docker Compose Application Service
|
||||
Requires=network.target podman.socket
|
||||
After=network.target podman.socket
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
WorkingDirectory=/home/brandonrozek
|
||||
ExecStartPre=/usr/bin/docker-compose pull
|
||||
ExecStart=/usr/bin/docker-compose up -d --force-recreate
|
||||
ExecStop=/usr/bin/docker-compose down
|
||||
TimeoutStartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
Loading…
Reference in a new issue