[READ-ONLY] Mirror of https://github.com/FoxxMD/docker-proxy-filter. Filter the contents of Docker API responses
docker docker-socket-proxy filter
0

Configure Feed

Select the types of activity you want to include in your feed.

docs: Add container labels

FoxxMD (Oct 9, 2025, 7:32 PM UTC) 6ebe213f 0a9c86eb

+55 -10
+55 -10
README.md
··· 15 15 16 16 ### Container Filtering 17 17 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): 19 + 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 22 + 23 + #### Filters 24 + 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 19 35 20 - Using this ENV changes Docker API responses: 36 + Containers: 21 37 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` 38 + * myproject-foo-1 <-- valid 39 + * coolthingbar-2 <-- valid 40 + * other-container <-- invalid 41 + ``` 24 42 25 - #### `SCRUB_ENVS` 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 26 70 27 71 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. 28 72 ··· 133 177 134 178 All configuration is done through environmental variables. 135 179 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 | 136 186 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 |