autodock is a Daemon for Docker Automation that helps to build automated Docker based infrastructure by integrating with Docker events
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.0 KiB

package main
import (
log ""
pkgver ""
flag ""
var (
dockerurl string
msgbusurl string
tlsverify bool
tlscacert string
tlscert string
tlskey string
tls bool
debug bool
version bool
bind string
func init() {
flag.StringP("config", "c", "", "path to config file")
flag.BoolVarP(&debug, "debug", "d", false, "enable debug logging")
flag.BoolVarP(&version, "version", "v", false, "display version information")
flag.StringVarP(&bind, "bind", "b", "", "[int]:<port> to bind to for HTTP")
flag.StringVar(&dockerurl, "docker-url", "", "Docker URL to connect to")
flag.StringVar(&msgbusurl, "msgbus-url", "", "MessageBus URL to connect to")
flag.BoolVar(&tls, "tls", false, "Use TLS; implied by --tlsverify")
flag.StringVar(&tlscacert, "tls-ca-cert", "", "Trust certs signed only by this CA")
flag.StringVar(&tlscert, "tls-cert", "", "Path to TLS certificate file")
flag.StringVar(&tlskey, "tls-key", "", "Path to TLS key file")
flag.BoolVar(&tlsverify, "tls-verify", true, "Use TLS and verify the remote")
func main() {
if version {
fmt.Printf("autodock v%s", pkgver.FullVersion())
if debug {
cfg := &config.Config{
Debug: debug,
Bind: bind,
DockerURL: dockerurl,
MsgBusURL: msgbusurl,
TLSCACert: tlscacert,
TLSCert: tlscert,
TLSKey: tlskey,
AllowInsecure: !tlsverify,
srv, err := server.NewServer(cfg)
if err != nil {
err = srv.EnableCollector()
if err != nil {
log.Fatalf("error enabling collector: %s", err)
if cfg.MsgBusURL == "" {
err = srv.EnableProxy()
if err != nil {
log.Fatalf("error enabling proxy: %s", err)
if err := srv.Run(); err != nil {