Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ Environment Variables:
DOCKER_HOST - default value for -endpoint
DOCKER_CERT_PATH - directory path containing key.pem, cert.pem and ca.pem
DOCKER_TLS_VERIFY - enable client TLS verification
DOCKER_CONTAINER_FILTERS - comma separated list of container filters for inclusion by docker-gen.
Filters supplied through this variable are ignored if -container-filter is provided.
```

If no `<dest>` file is specified, the output is sent to stdout. Mainly useful for debugging.
Expand Down
11 changes: 11 additions & 0 deletions cmd/docker-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ Environment Variables:
DOCKER_HOST - default value for -endpoint
DOCKER_CERT_PATH - directory path containing key.pem, cert.pem and ca.pem
DOCKER_TLS_VERIFY - enable client TLS verification
DOCKER_CONTAINER_FILTERS - comma separated list of container filters for inclusion by docker-gen.
Filters supplied through this variable are ignored if -container-filter is provided.
`)
println(`For more information, see https://github.com/nginx-proxy/docker-gen`)
}
Expand Down Expand Up @@ -149,6 +151,15 @@ func initFlags() {

flag.Usage = usage
flag.Parse()

// set containerFilter with DOCKER_CONTAINER_FILTERS if it's set and no -container-filter option was provided
if filtersEnvVar, found := os.LookupEnv("DOCKER_CONTAINER_FILTERS"); found && len(containerFilter) == 0 {
for filter := range strings.SplitSeq(filtersEnvVar, ",") {
if strings.TrimSpace(filter) != "" {
containerFilter.Set(filter)
}
}
}
}

func main() {
Expand Down
Loading