Skip to content

Commit 4c9d639

Browse files
committed
Move docker-gen emit struct from wiki to readme
1 parent 110ecfc commit 4c9d639

File tree

1 file changed

+67
-1
lines changed

1 file changed

+67
-1
lines changed

README.md

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,73 @@ If no `<dest>` file is specified, the output is sent to stdout. Mainly useful f
109109

110110
The templates used by docker-gen are written using the Go [text/template](http://golang.org/pkg/text/template/) language. In addition to the [built-in functions](http://golang.org/pkg/text/template/#hdr-Functions) supplied by Go, docker-gen provides a number of additional functions to make it simpler (or possible) to generate your desired output.
111111

112-
Within those templates, the object emitted by docker-gen will have [this structure](https://github.com/jwilder/docker-gen/wiki/Docker-Gen-Emit-Structure).
112+
#### Emit Structure
113+
114+
Within the templates, the object emitted by docker-gen will be a structure consisting of following Go structs:
115+
116+
```go
117+
type RuntimeContainer struct {
118+
ID string
119+
Addresses []Address
120+
Gateway string
121+
Name string
122+
Image DockerImage
123+
Env map[string]string
124+
Volumes map[string]Volume
125+
}
126+
127+
type Address struct {
128+
IP string
129+
Port string
130+
HostPort string
131+
Proto string
132+
}
133+
134+
type DockerImage struct {
135+
Registry string
136+
Repository string
137+
Tag string
138+
}
139+
140+
type Volume struct {
141+
Path string
142+
HostPath string
143+
ReadWrite bool
144+
}
145+
```
146+
147+
For example, this is a JSON version of an emitted RuntimeContainer struct:
148+
149+
```json
150+
{
151+
"ID":"71e9768075836eb38557adcfc71a207386a0c597dbeda240cf905df79b18cebf",
152+
"Addresses":[
153+
{
154+
"IP":"172.17.0.4",
155+
"Port":"22"
156+
}
157+
],
158+
"Gateway":"172.17.42.1",
159+
"Name":"docker_register",
160+
"Image":{
161+
"Registry":"jwilder",
162+
"Repository":"docker-register"
163+
},
164+
"Env":{
165+
"ETCD_HOST":"172.17.42.1:4001",
166+
"PATH":"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
167+
"DOCKER_HOST":"unix:///var/run/docker.sock",
168+
"HOST_IP":"172.17.42.1"
169+
},
170+
"Volumes":{
171+
"/mnt":{
172+
"Path":"/mnt",
173+
"HostPath":"/Users/joebob/tmp",
174+
"ReadWrite":true
175+
}
176+
}
177+
}
178+
```
113179

114180
#### Functions
115181

0 commit comments

Comments
 (0)