Created
June 18, 2015 05:31
-
-
Save ziozzang/ca862cc31fa78ee3d546 to your computer and use it in GitHub Desktop.
wait until for new docker event.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Code by Jioh L. Jung ([email protected]) | |
* This code is for wait until "new docker event comming..." | |
* just do exit when new event comming. | |
* how to build by docker | |
* $ docker run -v /opt/wait/:/opt/wait/ -i -t google/golang \ | |
/bin/bash -c "cd /opt/wait/ && go get github.com/samalba/dockerclient && go build" | |
*/ | |
package main | |
import ( | |
"github.com/samalba/dockerclient" | |
"time" | |
"os" | |
) | |
func eventCallback(event *dockerclient.Event, ec chan error, args ...interface{}) { | |
os.Exit(0) | |
} | |
func main() { | |
docker, _ := dockerclient.NewDockerClient("unix:///var/run/docker.sock", nil) | |
docker.StartMonitorEvents(eventCallback, nil) | |
time.Sleep(3600 * time.Second) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment