docker-mailserver/docs/content/advanced/maintenance/update-and-cleanup.md

35 lines
1.3 KiB
Markdown
Raw Normal View History

2020-05-29 06:16:30 +02:00
## Automatic update
Docker images are handy but it can get a a hassle to keep them updated. Also when a repository is automated you want to get these images when they get out.
2020-05-29 06:14:20 +02:00
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](https://hub.docker.com/r/containrrr/watchtower).
2020-05-29 05:58:54 +02:00
A docker-compose example:
```yaml
services:
watchtower:
restart: always
2020-05-29 06:14:20 +02:00
image: containrrr/watchtower:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
```
2020-05-29 06:16:30 +02:00
For more details, see the [manual](https://containrrr.github.io/watchtower/)
2020-05-29 06:16:30 +02:00
## Automatic cleanup
2020-05-29 06:16:30 +02:00
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](https://hub.docker.com/r/spotify/docker-gc/).
A docker-compose example:
```yaml
services:
docker-gc:
restart: always
image: spotify/docker-gc:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
```
2020-05-29 06:16:30 +02:00
For more details, see the [manual](https://github.com/spotify/docker-gc/blob/master/README.md)
2018-03-06 11:06:03 +01:00
2020-05-29 06:16:30 +02:00
Or you can just use the [`--cleanup`](https://containrrr.github.io/watchtower/arguments/#cleanup) option provided by containrrr/watchtower.