Skip to content

Commit 6ebe213

Browse files
committed
docs: Add container labels
1 parent 0a9c86e commit 6ebe213

File tree

1 file changed

+55
-10
lines changed

1 file changed

+55
-10
lines changed

README.md

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,58 @@ Combined with a socket-proxy container that provides granular endpoint access it
1515

1616
### Container Filtering
1717

18-
#### `CONTAINER_NAMES`
18+
DPF can modify the responses returned from the Docker API for any [Container related endpoint](https://docs.docker.com/reference/api/engine/version/v1.48/#tag/Container):
1919

20-
Using this ENV changes Docker API responses:
20+
* Filters [List Containers](https://docs.docker.com/reference/api/engine/version/v1.48/#tag/Container/operation/ContainerList) responses so any container that does not match filters is excluded from the return list
21+
* Any other [Container](https://docs.docker.com/reference/api/engine/version/v1.48/#tag/Container) endpoints will return 404 if it does not match a filter
2122

22-
* Filters [List Containers](https://docs.docker.com/reference/api/engine/version/v1.48/#tag/Container/operation/ContainerList) responses so any container with a name that does not include a value from `CONTAINER_NAMES` is removed.
23-
* Any other [Container](https://docs.docker.com/reference/api/engine/version/v1.48/#tag/Container) endpoints will return 404 if the container name does not include a value from `CONTAINER_NAMES`
23+
#### Filters
2424

25-
#### `SCRUB_ENVS`
25+
If a container matches **any** of these filters then it is valid and will be returned.
26+
27+
##### `CONTAINER_NAMES`
28+
29+
A comma-delimited list of values that a Container's name may include. Any value that matches will cause a Container to be valid.
30+
31+
Example
32+
33+
```
34+
CONTAINER_NAMES=foo,bar
35+
36+
Containers:
37+
38+
* myproject-foo-1 <-- valid
39+
* coolthingbar-2 <-- valid
40+
* other-container <-- invalid
41+
```
42+
43+
##### `CONTAINER_LABELS`
44+
45+
A comma-delimited list of labels with optional values (key-value) that any of a Container's labels may include. Any value that matches will cause a Container to be valid.
46+
47+
* If a filter is **only** a key (no `=`) then any Container label key that includes the string will match, regardless of value
48+
* If a filter is a full key-value (`my.label=value`) then
49+
* Container label key must include filter key
50+
* Container label value must include filter value
51+
52+
Example
53+
54+
```
55+
CONTAINER_LABELS=myfoo,com.bar=fun
56+
57+
Container A's labels
58+
* something=cool <-- invalid
59+
* com.something=nice <-- invalid
60+
* com.bar=fun <-- valid
61+
62+
Container B's labels
63+
* something=cool <-- invalid
64+
* com.myfoo.aaa=yo <-- valid
65+
* com.myfoo.bbb=hey <-- valid
66+
* com.bar=sad <-- invalid
67+
```
68+
69+
#### `SCRUB_ENVS` Modifier
2670

2771
When `true` any responses from the [Container Inspect](https://docs.docker.com/reference/api/engine/version/v1.48/#tag/Container/operation/ContainerInspect) endpoint will have `Config.Env` set to an empty array. This prevents leaking of sensitive `environment:`/`-e` variables that you passed to your container, over the network.
2872

@@ -133,9 +177,10 @@ Forbidden
133177

134178
All configuration is done through environmental variables.
135179

180+
| Key | Required | Default | Description |
181+
|--------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
182+
| `PROXY_URL` | yes | | The fully-qualified URL to proxy API requests EX `http://socket-proxy:2375` |
183+
| `CONTAINER_NAMES` | no | | A comma-delimited list of values to compare against a container name. |
184+
| `CONTAINER_LABELS` | no | | A comma-delimited list of key-values to compare against container labels. |
185+
| `SCRUB_ENVS` | no | false | Remove `Env` list from [container inspect API](https://docs.docker.com/reference/api/engine/version/v1.48/#tag/Container/operation/ContainerInspect) response |
136186

137-
| Key | Required | Default | Description |
138-
|-------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
139-
| `PROXY_URL` | yes | | The fully-qualified URL to proxy API requests EX `http://socket-proxy:2375` |
140-
| `CONTAINER_NAMES` | yes | | A comma-delimited list of values. Any container that contains any value as a substring will be allowed. |
141-
| `SCRUB_ENVS` | no | false | Remove `Env` list from [container inspect API](https://docs.docker.com/reference/api/engine/version/v1.48/#tag/Container/operation/ContainerInspect) response |

0 commit comments

Comments
 (0)