Skip to content

Instantly share code, notes, and snippets.

@scottferg
Forked from camsom/gist:e7dbac956c68b6437e42
Created October 16, 2014 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottferg/15499969407222039a67 to your computer and use it in GitHub Desktop.
Save scottferg/15499969407222039a67 to your computer and use it in GitHub Desktop.
# build
sudo docker build -t pokerap .
# run
sudo docker run -v /dev/log:/dev/log pokerap /go/bin/gokerap
# check syslog
sudo tail /var/log/syslog
# here are the cool lines I like
Oct 16 17:58:12 vagrant-ubuntu-trusty-64 go_log[1]: 2014/10/16 17:58:12 Docker is logging on the host machine.
Oct 16 17:58:12 vagrant-ubuntu-trusty-64 go_log[1]: 2014/10/16 17:58:12 GO LOGGING
#They're cool because of main.go
func main() {
logwriter, e := syslog.New(syslog.LOG_NOTICE, "go_log")
if e == nil {
fmt.Println("Hey Syslog")
log.SetOutput(logwriter)
}
log.Println("Docker is logging on the host machine.")
log.Print("GO LOGGING")
}
description "Runs the Zuul chat server"
start on local-filesystems
stop on deconfiguring-networking
pre-start script
docker kill zuul || true
docker rm zuul || true
end script
script
. /var/lib/cloud/instance/user-data.txt
exec docker run --rm -v /dev/log:/dev/log -p 8080:8080 --name zuul docker.vokalinteractive.com/zuul
end script
pre-stop script
docker stop zuul
end script
respawn
respawn limit 10 90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment