You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+60Lines changed: 60 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,6 +123,66 @@ Environment Variables:
123
123
124
124
If no `<dest>` file is specified, the output is sent to stdout. Mainly useful for debugging.
125
125
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
0 commit comments