Many people are wondering if there is an easy way to update container to newest version, while it is already configured and running. Normal procedure is to use docker pull, delete the old one and deploy the new one with the very same configuration as before.
Easy but frustrating 🙂
There is a tool that do it automatically named watchtower . It is also a Docker container and it interacts with the Docker API. In order to monitor the running containers, it needs to be mounted to /var/run/docker.sock with the -v flag when running. By default, watchtower will monitor all containers running within the Docker daemon:
docker run -d \ --name watchtower \ -v /var/run/docker.sock:/var/run/docker.sock \ v2tec/watchtower
It can monitor only specified containers:
docker run -d \ --name watchtower \ -v /var/run/docker.sock:/var/run/docker.sock \ v2tec/watchtower nginx redis