Created
August 24, 2014 12:20
-
-
Save passcod/ed3f8b107c37754f1fba to your computer and use it in GitHub Desktop.
Template file to dump docker-gen's output in YAML format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
{{ range $_, $cont := $ }} | |
{{ $addrLen := len $cont.Addresses }} | |
{{ $envLen := len $cont.Env }} | |
{{ $regLen := len $cont.Image.Registry }} | |
- id: "{{ $cont.ID }}" | |
{{ if eq $addrLen 0 }} | |
addresses: ~ | |
{{ else }} | |
addresses: | |
{{ range $i, $addr := $cont.Addresses }} | |
- ip: "{{ $addr.IP }}" | |
port: {{ $addr.Port }} | |
host_port: {{ $addr.HostPort }} | |
{{ end }} | |
{{ end }} | |
{{ if eq $envLen 0 }} | |
env: ~ | |
{{ else }} | |
env: | |
{{ range $key, $value := $cont.Env }} | |
{{ $key }}: "{{ $value }}" | |
{{ end }} | |
{{ end }} | |
gateway: "{{ $cont.Gateway }}" | |
image: | |
{{ with $image := $cont.Image }} | |
{{ if eq $regLen 0 }} | |
registry: ~ | |
{{ else }} | |
registry: "{{ $image.Registry }}" | |
{{ end }} | |
repository: {{ $image.Repository }} | |
tag: "{{ $image.Tag }}" | |
{{ end }} | |
name: {{ $cont.Name }} | |
{{ end }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment