Skip to content

Commit 7bc7ca9

Browse files
committed
Merge pull request #133 from frederickjh/master
Added info to docs about configuration file and example to example configuration file.
2 parents eabf082 + ff50782 commit 7bc7ca9

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,66 @@ Environment Variables:
123123

124124
If no `<dest>` file is specified, the output is sent to stdout. Mainly useful for debugging.
125125

126+
127+
### Configuration file
128+
129+
Using the -config flag from above you can tell docker-gen to use the specified config file instead of command-line options. Multiple templates can be defined and they will be executed in the order that they appear in the config file.
130+
131+
An example configuration file, **docker-gen.cfg** can be found in the examples folder.
132+
133+
#### Configuration File Syntax
134+
```
135+
[[config]]
136+
Starts a configuration section
137+
138+
dest = "path/to/a/file"
139+
path to a write the template. If not specfied, STDOUT is used
140+
141+
notifycmd = "/etc/init.d/foo reload"
142+
run command after template is regenerated (e.g restart xyz)
143+
144+
onlyexposed = true
145+
only include containers with exposed ports
146+
147+
template = "/path/to/a/template/file.tmpl"
148+
path to a template to generate
149+
150+
watch = true
151+
watch for container changes
152+
153+
154+
[config.NotifyContainers]
155+
Starts a notify container section
156+
157+
containername = 1
158+
container name followed by the signal to send
159+
160+
container_id = 1
161+
or the container id can be used followed by the signal to send
162+
```
163+
Putting it all together here is an example configuration file.
164+
```
165+
[[config]]
166+
template = "/etc/nginx/nginx.conf.tmpl"
167+
dest = "/etc/nginx/sites-available/default"
168+
onlyexposed = true
169+
notifycmd = "/etc/init.d/nginx reload"
170+
171+
[[config]]
172+
template = "/etc/logrotate.conf.tmpl"
173+
dest = "/etc/logrotate.d/docker"
174+
watch = true
175+
176+
[[config]]
177+
template = "/etc/docker-gen/templates/nginx.tmpl"
178+
dest = "/etc/nginx/conf.d/default.conf"
179+
watch = true
180+
181+
[config.NotifyContainers]
182+
nginx = 1 # 1 is a signal number to be sent; here SIGINT
183+
e75a60548dc9 = 1 # a key can be either container name (nginx) or ID
184+
```
185+
126186
===
127187

128188
### Templating

examples/docker-gen.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ notifycmd = "/etc/init.d/nginx reload"
88
template = "/etc/logrotate.conf.tmpl"
99
dest = "/etc/logrotate.d/docker"
1010
watch = true
11+
12+
[[config]]
13+
template = "/etc/docker-gen/templates/nginx.tmpl"
14+
dest = "/etc/nginx/conf.d/default.conf"
15+
watch = true
16+
[config.NotifyContainers]
17+
nginx = 1 # 1 is a signal number to be sent; here SIGINT
18+
e75a60548dc9 = 1 # a key can be either container name (nginx) or ID

0 commit comments

Comments
 (0)