@@ -151,7 +151,21 @@ func (r *RuntimeContainer) PublishedAddresses() []Address {
151151}
152152
153153func usage () {
154- println ("Usage: docker-gen [-config file] [-watch=false] [-notify=\" restart xyz\" ] [-notify-sighup=\" container-ID\" ] [-interval=0] [-endpoint tcp|unix://..] [-tlscert file] [-tlskey file] [-tlscacert file] [-tlsverify] <template> [<dest>]" )
154+ println (`Usage: docker-gen [options] template [dest]
155+
156+ Generate files from docker container meta-data
157+
158+ Options:` )
159+ flag .PrintDefaults ()
160+
161+ println (`
162+ Arguments:
163+ template - path to a template to generate
164+ dest - path to a write the template. If not specfied, STDOUT is used
165+
166+ Environment Variables:
167+ DOCKER_HOST - default value for -endpoint
168+ ` )
155169}
156170
157171func NewDockerClient (endpoint string ) (* docker.Client , error ) {
@@ -349,16 +363,20 @@ func initFlags() {
349363 flag .BoolVar (& version , "version" , false , "show version" )
350364 flag .BoolVar (& watch , "watch" , false , "watch for container changes" )
351365 flag .BoolVar (& onlyExposed , "only-exposed" , false , "only include containers with exposed ports" )
352- flag .BoolVar (& onlyPublished , "only-published" , false , "only include containers with published ports (implies -only-exposed)" )
353- flag .StringVar (& notifyCmd , "notify" , "" , "run command after template is regenerated" )
354- flag .StringVar (& notifySigHUPContainerID , "notify-sighup" , "" , "send HUP signal to container. Equivalent to `docker kill -s HUP container-ID`" )
366+
367+ flag .BoolVar (& onlyPublished , "only-published" , false ,
368+ "only include containers with published ports (implies -only-exposed)" )
369+ flag .StringVar (& notifyCmd , "notify" , "" , "run command after template is regenerated (e.g `restart xyz`)" )
370+ flag .StringVar (& notifySigHUPContainerID , "notify-sighup" , "" ,
371+ "send HUP signal to container. Equivalent to `docker kill -s HUP container-ID`" )
355372 flag .Var (& configFiles , "config" , "config files with template directives. Config files will be merged if this option is specified multiple times." )
356- flag .IntVar (& interval , "interval" , 0 , "notify command interval (s )" )
357- flag .StringVar (& endpoint , "endpoint" , "" , "docker api endpoint" )
373+ flag .IntVar (& interval , "interval" , 0 , "notify command interval (secs )" )
374+ flag .StringVar (& endpoint , "endpoint" , "" , "docker api endpoint (tcp|unix://..). Default unix:///var/run/docker.sock " )
358375 flag .StringVar (& tlsCert , "tlscert" , "" , "path to TLS client certificate file" )
359376 flag .StringVar (& tlsKey , "tlskey" , "" , "path to TLS client key file" )
360377 flag .StringVar (& tlsCaCert , "tlscacert" , "" , "path to TLS CA certificate file" )
361378 flag .BoolVar (& tlsVerify , "tlsverify" , false , "verify docker daemon's TLS certicate" )
379+ flag .Usage = usage
362380 flag .Parse ()
363381}
364382
0 commit comments