docker-mailserver/docs/content/config/advanced/maintenance/update-and-cleanup.md
2022-02-01 15:38:24 +01:00

1.3 KiB

title
Maintenance | Update and Cleanup

Automatic Update

Docker images are handy but it can become a hassle to keep them updated. Also when a repository is automated you want to get these images when they get out.

One could setup a complex action/hook-based workflow using probes, but there is a nice, easy to use docker image that solves this issue and could prove useful: watchtower.

A docker-compose example:

services:
  watchtower:
    restart: always
    image: containrrr/watchtower:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

For more details, see the manual

Automatic Cleanup

When you are pulling new images in automatically, it would be nice to have them cleaned up as well. There is also a docker image for this: spotify/docker-gc.

A docker-compose example:

services:
  docker-gc:
    restart: always
    image: spotify/docker-gc:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

For more details, see the manual

Or you can just use the --cleanup option provided by containrrr/watchtower.