Skip to content

Instantly share code, notes, and snippets.

@scyto
Created May 15, 2022 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scyto/1091c492fa0c8353be4cbfa3874c7f54 to your computer and use it in GitHub Desktop.
Save scyto/1091c492fa0c8353be4cbfa3874c7f54 to your computer and use it in GitHub Desktop.
use shepherd to update images

Update Swarm Images

i wanted to update swarm images whenever there is a new image available (even at the risk of breaking something)

it seems watchtower can't do this for swarm stacks/services - only one off containers.

I found this great container from https://github.com/djmaze/shepherd

placement considerations

Must be placed on a manager node.

Config notes

By default it will refresh all services, exclude any you dont want it to touch. I am not using apprise for this yet, but will be implementin apprise soon.

version: "3"
services:
  shepherd:
    build: .
    image: mazzolino/shepherd
    environment:
      - SLEEP_TIME=60m
      - IGNORELIST_SERVICES="shepherd_shepherd wordpress_db wordpress_wordpress"
      - ROLLBACK_ON_FAILURE=true
      - TZ=America/Los_Angeles
      - IMAGE_AUTOCLEAN_LIMIT=2
#      - APPRISE_SIDECAR_URL=apprise-microservice:5000      	
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      placement:
        constraints:
        - node.role == manager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment