Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

looking at downstream #1

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
f6381ea
Merge pull request #259 from cglewis/master
jwilder Nov 6, 2017
f211337
feat: Add "whereNot" function
Dec 1, 2017
af27dce
Merge pull request #264 from soprasteria/master
jwilder Dec 1, 2017
2e4136d
Fix ECS container ID parsing
jwilder Jan 14, 2018
96ef002
Merge pull request #271 from jwilder/jw-ecs
jwilder Jan 14, 2018
f94b279
Add builds for arm64
buchdag Jan 14, 2018
800c644
Added missing assignment to ECS match statement
maubergine Jan 18, 2018
b982c4a
Addressed formatting issue.
maubergine Jan 18, 2018
3dc9437
Merge pull request #275 from maubergine/maubergine-ecs-context-fix
jwilder Jan 18, 2018
41d6318
Merge pull request #272 from buchdag/arm64-build
jwilder Mar 23, 2018
3ccbea7
Bump Go versions
HaraldNordgren Oct 21, 2018
a6ecef7
Fix linter failures
HaraldNordgren Oct 21, 2018
af5260c
Merge pull request #292 from HaraldNordgren/go_versions
jwilder Oct 26, 2018
6f22e5f
Adjust import path.
JoelLinn May 1, 2020
61926c3
Multi stage Dockerfile. Build binary in place.
JoelLinn May 1, 2020
7e695f8
Update dependencies:
JoelLinn May 2, 2020
addea7b
Update dependencies:
JoelLinn May 2, 2020
dd0d3d9
Update dependencies:
JoelLinn May 2, 2020
c8d416f
Update dependencies:
JoelLinn May 2, 2020
e660381
Update dependencies:
JoelLinn May 2, 2020
56a42df
Update golang version in travis.
JoelLinn May 2, 2020
34afeac
Change repository URLs.
JoelLinn May 2, 2020
c1f43a9
Simplify readme.
JoelLinn May 2, 2020
c61e383
Bump version to v0.8.0
JoelLinn May 2, 2020
a8bcfe7
Remove go version 1.12 from travis.
JoelLinn May 2, 2020
d8a5cf7
Disable tests in dockerfile.
JoelLinn May 2, 2020
e75e7d2
User docker/docker isntead of moby/moby again.
JoelLinn May 2, 2020
a7d6c66
Fix exit(2) on SIGHUP before fully initialized.
JoelLinn May 2, 2020
e5fb8a0
Bump version to 0.8.1
JoelLinn May 2, 2020
d736d78
Add Labels to SwarmNode #303 https://github.com/jwilder/docker-gen/pu…
bugficks Jun 9, 2020
a2dd1ed
Add NetworkMode to RuntimeContainer #287. https://github.com/jwilder/…
bugficks Jun 9, 2020
214ff58
Add toLower and toUpper functions #306 https://github.com/jwilder/doc…
bugficks Jun 9, 2020
a5abae3
Allow more notify and restart options #283 https://github.com/jwilder…
bugficks Jun 9, 2020
7521952
gofmt fixes
bugficks Jun 9, 2020
251ba98
use go modules
bugficks Jul 11, 2020
71b1c18
add setHTPasswd method
bugficks Jul 11, 2020
0b289f0
change repo url
Jul 11, 2020
68bb4b2
fix linux built bin won't run on alpine
Jul 11, 2020
7602e67
CircleCI
Jul 11, 2020
41c6200
CirceCI
Jul 11, 2020
6939a89
Update README.md
bugficks Jul 11, 2020
ca4fef1
Build docker image from either gitub release or local directory
Jul 14, 2020
9bf1a16
go 1.14
Jul 14, 2020
350fdbd
Use CircleCI workflow to make github release
Jul 15, 2020
88ec289
change setHTPasswd to use sha instead of bcrypt if not specified
Jul 21, 2020
c8156f4
circleci
Jul 21, 2020
26dd3bc
go 1.16
Feb 28, 2021
bf31bf1
GetCurrentContainerID from /proc/self/mountinfo #335 + #336
Feb 28, 2021
2c40c82
drop darwin/386
Feb 28, 2021
209b041
0.8.5
Feb 28, 2021
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
63 changes: 63 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
build:
docker:
# specify the version
- image: circleci/golang:1.16

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

#### TEMPLATE_NOTE: go expects specific checkout path representing url
#### expecting it in the form of
#### /go/src/github.com/circleci/go-tool
#### /go/src/bitbucket.org/circleci/go-tool
working_directory: /go/src/github.com/bugficks/docker-gen
steps:
- checkout
- run: make test check-gofmt all
- run: make release
- run: echo "export VERSION=$(git describe --tags)" >> VERSION
- persist_to_workspace:
root: .
paths:
- VERSION
- release/*

publish-github-release:
docker:
- image: cibuilds/github:0.10
steps:
- attach_workspace:
at: .
- run:
name: "Publish Release on GitHub"
command: |
source VERSION
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./release/

# https://circleci.com/docs/2.0/workflows/#executing-workflows-for-a-git-tag
workflows:
version: 2
untagged-build:
jobs:
- build
tagged-build:
jobs:
- build:
filters:
tags:
only: /^\d+\.\d+\.\d+$/
- publish-github-release:
requires:
- build
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.git
#.git
docker-gen
dist
release
*.gz
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
language: go
go:
- 1.9
- "1.13"
- "1.14"
- "1.15"
- "1.16"
install:
- make get-deps
script:
Expand Down
56 changes: 51 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,58 @@
########################################################################################################################
#
ARG BUILD_ENV=github
ARG SOURCE_REPO=https://github.com/bugficks/docker-gen

########################################################################################################################
#
FROM golang:alpine as builder
LABEL stage=docker-gen-intermediate

ARG BUILD_ENV
ARG SOURCE_REPO

ENV BUILD_ENV=${BUILD_ENV:-github}\
SOURCE_REPO=${SOURCE_REPO}

RUN apk add --no-cache \
git \
make \
gcc \
libc-dev \
curl

########################################################################################################################
#
FROM builder as builder_github
ONBUILD RUN \
export TAG=${TAG:-$(curl -fsSLI -o /dev/null -w %{url_effective} ${SOURCE_REPO}/releases/latest | awk -F / '{print $NF}')} \
&& git clone ${SOURCE_REPO} --single-branch --branch ${TAG} --depth 1 /build

########################################################################################################################
#
FROM builder as builder_local
ONBUILD COPY . /build

########################################################################################################################
#
FROM builder_${BUILD_ENV} as final

# Tests are disabled here because docker build servers are too slow for ms dependent tests
WORKDIR /build

# Tests are disabled here because docker build servers are too slow for ms dependent tests
RUN make check-gofmt all

########################################################################################################################
#
FROM alpine:latest
LABEL maintainer="Jason Wilder <[email protected]>"

RUN apk -U add openssl
LABEL maintainer="github.com/bugficks/docker-gen"

RUN apk --no-cache add openssl

ENV VERSION 0.7.3
ENV DOWNLOAD_URL https://github.com/jwilder/docker-gen/releases/download/$VERSION/docker-gen-alpine-linux-amd64-$VERSION.tar.gz
ENV DOCKER_HOST unix:///tmp/docker.sock

RUN wget -qO- $DOWNLOAD_URL | tar xvz -C /usr/local/bin
COPY --from=final /build/docker-gen /usr/local/bin/

ENTRYPOINT ["/usr/local/bin/docker-gen"]
6 changes: 0 additions & 6 deletions GLOCKFILE

This file was deleted.

55 changes: 32 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
.SILENT :
.PHONY : docker-gen clean fmt
.PHONY : docker-gen dist dist-clean release check-gofmt test

TAG:=`git describe --tags`
TAG:=$(shell git describe --tags)
LDFLAGS:=-X main.buildVersion=$(TAG)
# https://stackoverflow.com/a/58185179
LDFLAGS_EXTRA=-linkmode external -w -extldflags "-static"

all: docker-gen

docker-gen:
echo "Building docker-gen"
go build -ldflags "$(LDFLAGS)" ./cmd/docker-gen
go build -ldflags "$(LDFLAGS) $(LDFLAGS_EXTRA)" ./cmd/docker-gen

dist-clean:
rm -rf dist
rm -f docker-gen-alpine-linux-*.tar.gz
rm -f docker-gen-linux-*.tar.gz
rm -f docker-gen-darwin-*.tar.gz
go mod tidy
rm -rf dist release/
rm -f docker-gen

dist: dist-clean
mkdir -p dist/alpine-linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/amd64/docker-gen ./cmd/docker-gen
mkdir -p dist/alpine-linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS) ${LDFLAGS_EXTRA}" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/amd64/docker-gen ./cmd/docker-gen
mkdir -p dist/alpine-linux/arm64 && GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/arm64/docker-gen ./cmd/docker-gen
mkdir -p dist/alpine-linux/armhf && GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/armhf/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/linux/amd64/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS) ${LDFLAGS_EXTRA}" -o dist/linux/amd64/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/arm64 && GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o dist/linux/arm64/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/i386 && GOOS=linux GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/linux/i386/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/armel && GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "$(LDFLAGS)" -o dist/linux/armel/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/armhf && GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "$(LDFLAGS)" -o dist/linux/armhf/docker-gen ./cmd/docker-gen
mkdir -p dist/darwin/amd64 && GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/darwin/amd64/docker-gen ./cmd/docker-gen
mkdir -p dist/darwin/i386 && GOOS=darwin GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/darwin/i386/docker-gen ./cmd/docker-gen

# mkdir -p dist/darwin/i386 && GOOS=darwin GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/darwin/i386/docker-gen ./cmd/docker-gen

release: dist
glock sync -n < GLOCKFILE
tar -cvzf docker-gen-alpine-linux-amd64-$(TAG).tar.gz -C dist/alpine-linux/amd64 docker-gen
tar -cvzf docker-gen-alpine-linux-armhf-$(TAG).tar.gz -C dist/alpine-linux/armhf docker-gen
tar -cvzf docker-gen-linux-amd64-$(TAG).tar.gz -C dist/linux/amd64 docker-gen
tar -cvzf docker-gen-linux-i386-$(TAG).tar.gz -C dist/linux/i386 docker-gen
tar -cvzf docker-gen-linux-armel-$(TAG).tar.gz -C dist/linux/armel docker-gen
tar -cvzf docker-gen-linux-armhf-$(TAG).tar.gz -C dist/linux/armhf docker-gen
tar -cvzf docker-gen-darwin-amd64-$(TAG).tar.gz -C dist/darwin/amd64 docker-gen
tar -cvzf docker-gen-darwin-i386-$(TAG).tar.gz -C dist/darwin/i386 docker-gen
mkdir -p release
tar -cvzf release/docker-gen-alpine-linux-amd64-$(TAG).tar.gz -C dist/alpine-linux/amd64 docker-gen
tar -cvzf release/docker-gen-alpine-linux-arm64-$(TAG).tar.gz -C dist/alpine-linux/arm64 docker-gen
tar -cvzf release/docker-gen-alpine-linux-armhf-$(TAG).tar.gz -C dist/alpine-linux/armhf docker-gen
tar -cvzf release/docker-gen-linux-amd64-$(TAG).tar.gz -C dist/linux/amd64 docker-gen
tar -cvzf release/docker-gen-linux-arm64-$(TAG).tar.gz -C dist/linux/arm64 docker-gen
tar -cvzf release/docker-gen-linux-i386-$(TAG).tar.gz -C dist/linux/i386 docker-gen
tar -cvzf release/docker-gen-linux-armel-$(TAG).tar.gz -C dist/linux/armel docker-gen
tar -cvzf release/docker-gen-linux-armhf-$(TAG).tar.gz -C dist/linux/armhf docker-gen
tar -cvzf release/docker-gen-darwin-amd64-$(TAG).tar.gz -C dist/darwin/amd64 docker-gen
# tar -cvzf release/docker-gen-darwin-i386-$(TAG).tar.gz -C dist/darwin/i386 docker-gen

get-deps:
go get github.com/robfig/glock
glock sync -n < GLOCKFILE

check-gofmt:
if [ -n "$(shell gofmt -l .)" ]; then \
Expand All @@ -50,4 +52,11 @@ check-gofmt:
fi

test:
go test
go test ./...

# build docker image from either latest release on github or local directory
# BUILD_ENV: (github | local) default=github
.PHONY: docker-image
docker-image:
docker build -t docker-gen . --build-arg BUILD_ENV=$${BUILD_ENV:-github}
docker tag docker-gen docker-gen:$(shell docker run --rm -it docker-gen:latest -version)
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
docker-gen
=====

![latest 0.7.3](https://img.shields.io/badge/latest-0.7.3-green.svg?style=flat)
[![Build Status](https://travis-ci.org/jwilder/docker-gen.svg?branch=master)](https://travis-ci.org/jwilder/docker-gen)
![latest 0.8.5](https://img.shields.io/badge/latest-0.8.5-green.svg?style=flat)
[![Travis CI](https://travis-ci.org/bugficks/docker-gen.svg?branch=master)](https://travis-ci.org/github/bugficks/docker-gen)
[![CircleCI](https://circleci.com/gh/bugficks/docker-gen.svg?style=svg)](https://circleci.com/gh/bugficks/docker-gen)
![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)
![Go Version](https://img.shields.io/github/go-mod/go-version/bugficks/docker-gen)

`docker-gen` is a file generator that renders templates using docker container meta-data.

It can be used to generate various kinds of files for:

* **Centralized logging** - [fluentd](https://github.com/jwilder/docker-gen/blob/master/templates/fluentd.conf.tmpl), logstash or other centralized logging tools that tail the containers JSON log file or files within the container.
* **Log Rotation** - [logrotate](https://github.com/jwilder/docker-gen/blob/master/templates/logrotate.tmpl) files to rotate container JSON log files
* **Reverse Proxy Configs** - [nginx](https://github.com/jwilder/docker-gen/blob/master/templates/nginx.tmpl), [haproxy](https://github.com/jwilder/docker-discover), etc. reverse proxy configs to route requests from the host to containers
* **Centralized logging** - [fluentd](https://github.com/bugficks/docker-gen/blob/master/templates/fluentd.conf.tmpl), logstash or other centralized logging tools that tail the containers JSON log file or files within the container.
* **Log Rotation** - [logrotate](https://github.com/bugficks/docker-gen/blob/master/templates/logrotate.tmpl) files to rotate container JSON log files
* **Reverse Proxy Configs** - [nginx](https://github.com/bugficks/docker-gen/blob/master/templates/nginx.tmpl), [haproxy](https://github.com/jwilder/docker-discover), etc. reverse proxy configs to route requests from the host to containers
* **Service Discovery** - Scripts (python, bash, etc..) to register containers within [etcd](https://github.com/jwilder/docker-register), hipache, etc..

===
Expand All @@ -25,17 +27,13 @@ There are three common ways to run docker-gen:

#### Host Install

Linux/OSX binaries for release [0.7.3](https://github.com/jwilder/docker-gen/releases)

* [amd64](https://github.com/jwilder/docker-gen/releases/download/0.7.3/docker-gen-linux-amd64-0.7.3.tar.gz)
* [i386](https://github.com/jwilder/docker-gen/releases/download/0.7.3/docker-gen-linux-i386-0.7.3.tar.gz)
* [alpine-linux](https://github.com/jwilder/docker-gen/releases/download/0.7.3/docker-gen-alpine-linux-amd64-0.7.3.tar.gz)
Linux/OSX binaries for [release](https://github.com/bugficks/docker-gen/releases)

Download the version you need, untar, and install to your PATH.

```
$ wget https://github.com/jwilder/docker-gen/releases/download/0.7.3/docker-gen-linux-amd64-0.7.3.tar.gz
$ tar xvzf docker-gen-linux-amd64-0.7.3.tar.gz
$ wget https://github.com/bugficks/docker-gen/releases/download/VERSION/docker-gen-linux-amd64-VERSION.tar.gz
$ tar xvzf docker-gen-linux-amd64-VERSION.tar.gz
$ ./docker-gen
```

Expand All @@ -50,7 +48,7 @@ docker-gen within a container to do service registration with etcd.

#### Separate Container Install

It can also be run as two separate containers using the [jwilder/docker-gen](https://index.docker.io/u/jwilder/docker-gen/)
It can also be run as two separate containers using the [joellinn/docker-gen](https://index.docker.io/u/joellinn/docker-gen/)
image, together with virtually any other image.

This is how you could run the official [nginx](https://registry.hub.docker.com/_/nginx/) image and
Expand All @@ -66,11 +64,11 @@ $ docker run -d -p 80:80 --name nginx -v /tmp/nginx:/etc/nginx/conf.d -t nginx
Fetch the template and start the docker-gen container with the shared volume:
```
$ mkdir -p /tmp/templates && cd /tmp/templates
$ curl -o nginx.tmpl https://raw.githubusercontent.com/jwilder/docker-gen/master/templates/nginx.tmpl
$ curl -o nginx.tmpl https://raw.githubusercontent.com/joellinn/docker-gen/master/templates/nginx.tmpl
$ docker run -d --name nginx-gen --volumes-from nginx \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
-v /tmp/templates:/etc/docker-gen/templates \
-t jwilder/docker-gen -notify-sighup nginx -watch -only-exposed /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
-t joellinn/docker-gen -notify-sighup nginx -watch -only-exposed /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
```

===
Expand All @@ -95,8 +93,13 @@ Options:
run command after template is regenerated (e.g restart xyz)
-notify-output
log the output(stdout/stderr) of notify command
-notify-container container-ID
container to send a signal to
-notify-signal signal
signal to send to the -notify-container. -1 to call docker restart. Defaults to 1 aka. HUP.
All available signals available on the [dockerclient](https://github.com/fsouza/go-dockerclient/blob/01804dec8a84d0a77e63611f2b62d33e9bb2b64a/signal.go)
-notify-sighup container-ID
send HUP signal to container. Equivalent to 'docker kill -s HUP container-ID'
send HUP signal to container. Equivalent to 'docker kill -s HUP container-ID' or `-notify-container container-ID -notify-signal 1`
-only-exposed
only include containers with exposed ports
-only-published
Expand Down Expand Up @@ -363,16 +366,20 @@ For example, this is a JSON version of an emitted RuntimeContainer struct:
* *`json $value`*: Returns the JSON representation of `$value` as a `string`.
* *`keys $map`*: Returns the keys from `$map`. If `$map` is `nil`, a `nil` is returned. If `$map` is not a `map`, an error will be thrown.
* *`last $array`*: Returns the last value of an array.
* *`parseBool $string`*: parseBool returns the boolean value represented by the string. It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False. Any other value returns an error. Alias for [`strconv.ParseBool`](http://golang.org/pkg/strconv/#ParseBool)
* *`parseBool $string`*: parseBool returns the boolean value represented by the string. It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False. Any other value returns an error. Alias for [`strconv.ParseBool`](http://golang.org/pkg/strconv/#ParseBool)
* *`replace $string $old $new $count`*: Replaces up to `$count` occurences of `$old` with `$new` in `$string`. Alias for [`strings.Replace`](http://golang.org/pkg/strings/#Replace)
* *`sha1 $string`*: Returns the hexadecimal representation of the SHA1 hash of `$string`.
* *`setHTPasswd $file $user $password`*: Creates or adds `$user` with `$password` to htpasswd `$file`.
* *`split $string $sep`*: Splits `$string` into a slice of substrings delimited by `$sep`. Alias for [`strings.Split`](http://golang.org/pkg/strings/#Split)
* *`splitN $string $sep $count`*: Splits `$string` into a slice of substrings delimited by `$sep`, with number of substrings returned determined by `$count`. Alias for [`strings.SplitN`](https://golang.org/pkg/strings/#SplitN)
* *`trimPrefix $prefix $string`*: If `$prefix` is a prefix of `$string`, return `$string` with `$prefix` trimmed from the beginning. Otherwise, return `$string` unchanged.
* *`trimSuffix $suffix $string`*: If `$suffix` is a suffix of `$string`, return `$string` with `$suffix` trimmed from the end. Otherwise, return `$string` unchanged.
* *`trim $string`*: Removes whitespace from both sides of `$string`.
* *`toLower $string`*: Replace capital letters in `$string` to lowercase.
* *`toUpper $string`*: Replace lowercase letters in `$string` to uppercase.
* *`when $condition $trueValue $falseValue`*: Returns the `$trueValue` when the `$condition` is `true` and the `$falseValue` otherwise
* *`where $items $fieldPath $value`*: Filters an array or slice based on the values of a field path expression `$fieldPath`. A field path expression is a dot-delimited list of map keys or struct member names specifying the path from container to a nested value. Returns an array of items having that value.
* *`whereNot $items $fieldPath $value`*: Filters an array or slice based on the values of a field path expression `$fieldPath`. A field path expression is a dot-delimited list of map keys or struct member names specifying the path from container to a nested value. Returns an array of items **not** having that value.
* *`whereExist $items $fieldPath`*: Like `where`, but returns only items where `$fieldPath` exists (is not nil).
* *`whereNotExist $items $fieldPath`*: Like `where`, but returns only items where `$fieldPath` does not exist (is nil).
* *`whereAny $items $fieldPath $sep $values`*: Like `where`, but the string value specified by `$fieldPath` is first split by `$sep` into a list of strings. The comparison value is a string slice with possible matches. Returns items which OR intersect these values.
Expand Down Expand Up @@ -433,13 +440,8 @@ $ docker-gen -notify "/bin/bash /tmp/etcd.sh" -interval 10 templates/etcd.tmpl /

### Development

This project uses [glock](https://github.com/robfig/glock) for managing 3rd party dependencies.
You'll need to install glock into your workspace before hacking on docker-gen.

```
$ git clone <your fork>
$ cd <your fork>
$ make get-deps
$ make
```

Expand Down
Loading