Observe docker images and notify some listeners.
237
Docker-Image-Watcher is a server component which can observe docker images and notify some listeners. So you can use it to trigger re-build you docker images if a base docker images was updated.
First of all you need a running postgres database:
docker run --rm --name postgres \
-p 5432:5432 \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_DB=postgres \
postgres:alpine
Then you can start the application:
docker run -p 8080:8080 \
--link postgres \
-e DATABASE_HOST=postgres \
rainu/docker-image-watcher
Or if you have docker-compose installed. You can just use this command:
docker run -p 8080:8080 \
--link postgres \
-e DATABASE_HOST=postgres \
rainu/docker-image-watcher
The following curl let observe the alpine:latest image and trigger the example.org/trigger endpoint:
curl -v -XPOST localhost:8080/api/v1/registry -d '{"image": "library/alpine", "trigger": {"name": "test", "url": "http://example.org/trigger"}}'
| ENV-Variable | Default-Value | required | Description |
|---|---|---|---|
| BIND_PORT | 8080 | false | The port where the service listen on |
| OBSERVATION_INTERVAL | 1m | false | The interval for checking the observations (registry lookup) |
| OBSERVATION_DISPATCH_INTERVAL | 30s | false | The interval for looking processable observations |
| OBSERVATION_LIMIT | 10 | false | How many observations should be check simultaneously |
| NOTIFICATION_DISPATCH_INTERVAL | 1m | false | The interval looking for overdue listeners |
| NOTIFICATION_LIMIT | 60 | false | How many listeners should be notify simultaneously |
| NOTIFICATION_TIMEOUT | 10s | false | The connection timeout for each listener |
| DATABASE_SSL | disable | false | The database ssl mode: enable/disable |
| DATABASE_HOST | localhost | false | The database host |
| DATABASE_PORT | 5432 | false | The database port |
| DATABASE_SCHEMA | postgres | false | The database schema |
| DATABASE_USER | postgres | false | The database user |
| DATABASE_PASSWORD | postgres | false | The database password |
See the API-Documentation
The following scriptlet shows how to setup the project and build from source code.
mkdir -p ./workspace/src
export GOPATH=./workspace
cd ./workspace/src
git clone [email protected]:rainu/docker-image-watcher.git
cd docker-image-watcher
go get ./...
go build -ldflags -s -a -installsuffix cgo ./cmd/watcher/
Distributed under the MIT license. See LICENSE for more information.
I searched a solution to automatically re-build my own docker images after the base image (such like alpine) was updated. The official docker-hub dont offer such a solution. You can only expose a trigger api for your own docker image. But the triggering is on your own. So this application is the link between observation and triggering.
git checkout -b feature/fooBar)git commit -am 'Add some fooBar')git push origin feature/fooBar)Content type
Image
Digest
Size
6.3 MB
Last updated
about 7 years ago
docker pull rainu/docker-image-watcher