@@ -173,6 +173,40 @@ deploy a project:
173
173
```
174
174
With this, the container will be named something like ` backend-4f692997 ` .
175
175
176
+ ### Container Labels
177
+
178
+ You may add arbitrary labels to your containers by calling ` labels ` with a hash.
179
+ The call is cumulative, so you may express patterns like:
180
+
181
+ ``` ruby
182
+ namespace :environment do
183
+ task :common do
184
+ set :image , ' example.com/newrelic/radio-radio'
185
+ host ' docker-server-1.example.com'
186
+ labels team: ' radio-ops'
187
+ end
188
+
189
+ desc ' Staging environment'
190
+ task :staging => :common do
191
+ labels environment: ' radio-staging'
192
+ env_vars YOUR_ENV: ' staging'
193
+ end
194
+ end
195
+ ```
196
+
197
+ This would result in the container having two labels, as shown in a
198
+ ` docker inspect ` example:
199
+
200
+ ```
201
+ "Labels": {
202
+ "team": "radio-ops",
203
+ "environment": "radio-staging"
204
+ }
205
+ ```
206
+
207
+ Hash keys and values will be stringified, so you may pass any object with a
208
+ ` #to_s ` method.
209
+
176
210
### Container Hostnames
177
211
178
212
If you don't specify a hostname to use inside your container, the container
@@ -215,8 +249,10 @@ set :network_mode, 'networkmode'
215
249
Docker (and therefore Centurion) supports one of ` bridge ` (the default), ` host ` ,
216
250
and ` container:<container-id> ` for this argument.
217
251
218
- * Note:* While ` host_port ` remains required, the mappings specified in it are
219
- * ignored* when using ` host ` and ` container... ` network modes.
252
+ In ` host ` and ` container... ` network modes, you may specify a
253
+ ` host_port, container_port ` mapping, however the port numbers will only be used
254
+ for container health checks. The mapping itself, while still passed via the API,
255
+ will be ignored by Docker.
220
256
221
257
### CGroup Resource Constraints
222
258
0 commit comments