all-in-one/Containers/watchtower/start.sh
Apoorv Parle ee23d43ca7 Update watchtower to a well-maintained fork and add podman support
Signed-off-by: Apoorv Parle <19315187+apparle@users.noreply.github.com>
2025-06-11 22:48:52 -07:00

26 lines
868 B
Bash

#!/bin/bash
# Check if socket is available and readable
if ! [ -a "/var/run/docker.sock" ]; then
echo "Docker socket is not available. Cannot continue."
exit 1
elif ! test -r /var/run/docker.sock; then
echo "Docker socket is not readable by the root user. Cannot continue."
exit 1
fi
if [ -f /run/.containerenv ]; then
# If running under podman disable memory_swappiness setting in watchtower.
# It is a necessary workaround until https://github.com/containers/podman/issues/23824 gets fixed.
echo "Running under Podman. Setting WATCHTOWER_DISABLE_MEMORY_SWAPPINESS to 1."
export WATCHTOWER_DISABLE_MEMORY_SWAPPINESS=1
fi
if [ -n "$CONTAINER_TO_UPDATE" ]; then
exec /watchtower --cleanup --debug --run-once "$CONTAINER_TO_UPDATE"
else
echo "'CONTAINER_TO_UPDATE' is not set. Cannot update anything."
exit 1
fi
exec "$@"