Skip to content

Commit 0fa949d

Browse files
authored
Merge pull request #178 from newrelic/jonathan/label-readme
1.8.10 features readme
2 parents 797416c + bfedbe3 commit 0fa949d

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

README.md

+38-2
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,40 @@ deploy a project:
173173
```
174174
With this, the container will be named something like `backend-4f692997`.
175175

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+
176210
### Container Hostnames
177211

178212
If you don't specify a hostname to use inside your container, the container
@@ -215,8 +249,10 @@ set :network_mode, 'networkmode'
215249
Docker (and therefore Centurion) supports one of `bridge` (the default), `host`,
216250
and `container:<container-id>` for this argument.
217251

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.
220256

221257
### CGroup Resource Constraints
222258

0 commit comments

Comments
 (0)