From eb2f30a91af1805a77f8d33a7c8972cc1ff90fc9 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Fri, 26 Dec 2025 14:24:10 +0100 Subject: [PATCH] chore(podman): run syncthing --- .vscode/settings.json | 1 + .../syncthing/docker-compose.osx.yml | 12 ++- .../syncthing/docker-compose.yml | 16 +++- knowledge base/podman.md | 92 +++++++++++++++++-- 4 files changed, 107 insertions(+), 14 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ea8adb9..7c29c48 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -334,6 +334,7 @@ "subvolume", "swapfile", "swapon", + "syncthing", "sysctls", "sysrc", "systool", diff --git a/docker compositions/syncthing/docker-compose.osx.yml b/docker compositions/syncthing/docker-compose.osx.yml index d3f803d..2775a74 100644 --- a/docker compositions/syncthing/docker-compose.osx.yml +++ b/docker compositions/syncthing/docker-compose.osx.yml @@ -1,16 +1,17 @@ --- -# See https://github.com/syncthing/syncthing/blob/main/README-Docker.md +# Refer https://github.com/syncthing/syncthing/blob/main/README-Docker.md version: "3" services: syncthing: - image: syncthing/syncthing:1.27.8 + image: syncthing/syncthing:2.0.12 container_name: syncthing hostname: MacBook-Pro environment: - PUID=501 - PGID=20 + - STGUIADDRESS=0.0.0.0:8384 volumes: - - ${PWD}/config:/var/syncthing/config + - config:/var/syncthing/config:z - ${PWD}/data:/var/syncthing/data ports: # No way to use 'host' mode in OS X @@ -19,5 +20,10 @@ services: - 22000:22000/udp # QUIC file transfers - 21027:21027/udp # Receive local discovery broadcasts restart: unless-stopped + healthcheck: + test: curl -fkLsS -m 2 127.0.0.1:8384/rest/noauth/health | grep -o --color=never OK || exit 1 + interval: 1m + timeout: 10s + retries: 3 volumes: config: diff --git a/docker compositions/syncthing/docker-compose.yml b/docker compositions/syncthing/docker-compose.yml index aa1f922..9511976 100644 --- a/docker compositions/syncthing/docker-compose.yml +++ b/docker compositions/syncthing/docker-compose.yml @@ -1,18 +1,24 @@ --- -# See https://github.com/syncthing/syncthing/blob/main/README-Docker.md +# Refer https://github.com/syncthing/syncthing/blob/main/README-Docker.md version: "3" services: syncthing: - image: syncthing/syncthing:1.27.7 + image: syncthing/syncthing:2.0.12 container_name: syncthing hostname: ${HOSTNAME} environment: - - PUID=1000 - - PGID=100 + - PUID=${UID-1000} # use 0 with podman + - PGID=${GID-1000} # use 0 with podman + - STGUIADDRESS=0.0.0.0:8384 volumes: - - config:/var/syncthing/config + - config:/var/syncthing/config:z - ${PWD}/data:/var/syncthing/data network_mode: host restart: unless-stopped + healthcheck: + test: curl -fkLsS -m 2 127.0.0.1:8384/rest/noauth/health | grep -o --color=never OK || exit 1 + interval: 1m + timeout: 10s + retries: 3 volumes: config: diff --git a/knowledge base/podman.md b/knowledge base/podman.md index 878ce22..cce1226 100644 --- a/knowledge base/podman.md +++ b/knowledge base/podman.md @@ -5,23 +5,98 @@ Intended to be a drop-in replacement for [Docker]. 1. [TL;DR](#tldr) 1. [Further readings](#further-readings) + 1. [Sources](#sources) ## TL;DR +
+ Setup + ```sh -# Install Podman. -sudo apt install 'podman' -sudo dnf install 'podman' -sudo pacman -S 'podman' -sudo zypper install 'podman' +# Install. +apt install 'podman' 'podman-compose' +dnf install 'podman' +pacman -S 'podman' +zypper install 'podman' + +# Add container registries to use. +echo 'unqualified-search-registries = ["docker.io"]' > "$HOME/.config/containers/registries.conf" +echo 'unqualified-search-registries = ["docker.io"]' | tee -a '/etc/containers/registries.conf.d/docker.io' + +# Set aliases for container registries. +cat < + +
+ Usage + +```sh +# Get the version. +podman --version + +# Get help. +man podman +man 'containers-registries.conf' + +# List local images. +podman image list +podman images + +# Search for images. +podman search 'fedora' +podman search --format "{{.Name}}\t{{.Stars}}\t{{.Official}}" --limit 3 'alpine' +podman search --list-tags 'registry.access.redhat.com/ubi8' --limit 4 + +# Pull images. +podman pull 'docker.io/library/postgres' +podman pull 'docker.io/library/python:3.10' +podman-compose pull + +# List volumes. +podman volume ls +podman volume list + +# Get a shell in containers. +podman run --rm --name 'syncthing' --tty --interactive --entrypoint 'sh' 'syncthing/syncthing' +podman-compose run --rm --entrypoint 'sh' 'syncthing' + +# Check running containers. +podman ps +podman ps --all + +# Manage compositions. +podman-compose up +podman-compose up --detach +podman-compose ps +podman-compose down + +# Execute commands in containers. +podman-compose exec 'syncthing' whoami + +# Clean up. +podman system prune +podman system prune --all +``` + +
+ ## Further readings - [Website] +- [Documentation] - [Docker] - [Containerd] - [Kaniko] +- [Volumes and rootless Podman] + +### Sources + +- [Pull Official Images From Docker Hub Using Podman] -[website]: https://podman.io/ +[Documentation]: https://docs.podman.io/en/stable/ +[Website]: https://podman.io/ + + +[Pull Official Images From Docker Hub Using Podman]: https://www.baeldung.com/ops/podman-pull-image-docker-hub +[Volumes and rootless Podman]: https://blog.christophersmart.com/2021/01/31/volumes-and-rootless-podman/