References:
About
Shepherd is a Docker swarm service for automatically updating your services whenever their base image is refreshed.
Variables
- Default check time is every 5 minutes. Change this with the
SLEEP_TIMEvariable. - Control which services aren’t updated with the
IGNORELIST_SERVICESvariable. Ignored services should be in a space separated list of service names. - As an alternative to ignore, use
FILTER_SERVICESto specify which services you want updated. - Notifications can be enabled through the appraise micro service and the
APPRISE_SIDECAR_URLvariable. - Set the timezone with the
TZvariable. Note, do not include quotations for the timezone. - Clean up old services with
IMAGE_AUTOCLEAN_LIMIT, the variable set keeps that number of old images.
Setup:
- Docker Compose
version: "3"
services:
app:
image: containrrr/shepherd
environment:
APPRISE_SIDECAR_URL: notify:5000
TZ: Pacific/Honolulu
IMAGE_AUTOCLEAN_LIMIT: 2
SLEEP_TIME: '360m'
FILTER_SERVICES: "label=shepherd.autodeploy"
VERBOSE: 'true'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- notification
deploy:
placement:
constraints:
- node.role == manager
notify:
image: mazzolino/apprise-microservice:latest
environment:
NOTIFICATION_URLS: discord:[add your URL here]
networks:
- notification
networks:
notification:
- Docker Run
docker service create --name shepherd --constraint "node.role==manager" --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,ro containrrr/shepherd
Notes:
- Notifications runs through the apprise microservice which runs on Apprise. The format for discord notifications is:
discord://webhook_id/webhook_tokenordiscord://avatar@webhook_id/webhook_token.