Sign inSign up

rainu/docker-image-watcher

By rainu

Updated about 7 years ago

Observe docker images and notify some listeners.

Image
0

237

rainu/docker-image-watcher repository overview

docker image watcher

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.

Installation

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

Usage example

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"}}'

Documentation

Configuration
ENV-VariableDefault-ValuerequiredDescription
BIND_PORT8080falseThe port where the service listen on
OBSERVATION_INTERVAL1mfalseThe interval for checking the observations (registry lookup)
OBSERVATION_DISPATCH_INTERVAL30sfalseThe interval for looking processable observations
OBSERVATION_LIMIT10falseHow many observations should be check simultaneously
NOTIFICATION_DISPATCH_INTERVAL1mfalseThe interval looking for overdue listeners
NOTIFICATION_LIMIT60falseHow many listeners should be notify simultaneously
NOTIFICATION_TIMEOUT10sfalseThe connection timeout for each listener
DATABASE_SSLdisablefalseThe database ssl mode: enable/disable
DATABASE_HOSTlocalhostfalseThe database host
DATABASE_PORT5432falseThe database port
DATABASE_SCHEMApostgresfalseThe database schema
DATABASE_USERpostgresfalseThe database user
DATABASE_PASSWORDpostgresfalseThe database password
API

See the API-Documentation

Development setup

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/

Release History

  • 0.0.1 The first implementation

Meta

Distributed under the MIT license. See LICENSE for more information.

Intention

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.

Contributing

  1. Fork it (https://github.com/rainu/docker-image-watcher/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Tag summary

Content type

Image

Digest

Size

6.3 MB

Last updated

about 7 years ago

docker pull rainu/docker-image-watcher