Checks for new Docker images and executes commands if a new image is available.
./autopull /path/to/configuration.json
Create a text file with an array of JSON Dicts:
[
{
"Image": "debian",
"Tag": "10",
"Actions": ["systemctl restart foo.service"]
},
{
"Image": "my-custom-image",
"Tag": "latest",
"Actions": ["docker stop foo",
"docker rm foo",
"docker run --name foo my-custom-image:latest"
]
}
]
Log levels can be set with an environment variable LOGLEVEL
.
Valid log levels are:
- info
- error
- warn
- debug
If not set or another level is specified, the application will default to info.
Drop the binary onto a host, along with an appropriate configuration file, and install a crontab.
Example (check every 5 minutes):
*/5 * * * * /usr/local/bin/autopull /etc/autopull_conf.json
If the specified image is not present on the Docker host, no action will be taken.