2021-11-30 18:20:42 +08:00
|
|
|
#!/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
|
2021-12-03 19:14:39 +08:00
|
|
|
elif ! test -r /var/run/docker.sock; then
|
2021-12-06 23:39:39 +08:00
|
|
|
echo "Docker socket is not readable by the root user. Cannot continue."
|
|
|
|
exit 1
|
2021-11-30 18:20:42 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$CONTAINER_TO_UPDATE" ]; then
|
2022-12-01 23:14:58 +08:00
|
|
|
exec /watchtower --cleanup --debug --run-once "$CONTAINER_TO_UPDATE"
|
2021-11-30 18:20:42 +08:00
|
|
|
else
|
|
|
|
echo "'CONTAINER_TO_UPDATE' is not set. Cannot update anything."
|
2021-12-03 19:14:39 +08:00
|
|
|
exit 1
|
2021-11-30 18:20:42 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
exec "$@"
|