···11+# Docker Proxy Filter
22+33+[](https://opensource.org/licenses/MIT)
44+[](https://hub.docker.com/r/foxxmd/docker-proxy-filter)
55+66+Docker Proxy Filter (DPF) is a smol, forward proxy for **filtering the _content_ and _responses_** of Docker API responses to only those you want to expose.
77+88+Unlike the OG [docker-socket-proxy](https://github.com/Tecnativa/docker-socket-proxy) and its variants, DPF provides filtering of the _response content_ from the Docker API, rather than disabling/enabling of API endpoints.
99+1010+It does not connect directly to the Docker socket: it designed to be used with another Docker "Socket Proxy" container.
1111+1212+Combined with a socket-proxy container that provides granular endpoint access it's possible to expose only information about specific containers in a read-only context.
1313+1414+## Example
1515+1616+```yaml
1717+services:
1818+ proxy-filter:
1919+ image: foxxmd/docker-proxy-filter
2020+ environment:
2121+ - PROXY_URL=http://socket-proxy:2375
2222+ - CONTAINER_NAME=foo,bar
2323+ - SCRUB_ENVS=true
2424+ ports:
2525+ - 2375:2375
2626+ socket-proxy:
2727+ image: wollomatic/socket-proxy:1.10.0
2828+ restart: unless-stopped
2929+ user: 0:0
3030+ mem_limit: 64M
3131+ read_only: true
3232+ cap_drop:
3333+ - ALL
3434+ security_opt:
3535+ - no-new-privileges
3636+ command:
3737+ - '-loglevel=debug'
3838+ - '-allowGET=/_ping|v1\..{1,2}/(info|containers.*)'
3939+ - '-listenip=0.0.0.0'
4040+ - '-allowfrom=proxy-filter'
4141+ - '-stoponwatchdog'
4242+ - '-shutdowngracetime=5'
4343+ volumes:
4444+ - /var/run/docker.sock:/var/run/docker.sock:ro
4545+```
4646+4747+On your machine you are running these containers:
4848+4949+5050+| Id | Name |
5151+|------|--------------|
5252+| 1234 | foo |
5353+| abcd | bar |
5454+| 6969 | cool-program |
5555+| 0444 | fun-program |
5656+5757+```shell
5858+$ curl -i http://localhost:2375/v1.47/containers
5959+HTTP/1.1 200 OK
6060+content-length: 1234
6161+content-type: application/json
6262+date: Wed, 08 Oct 2025 00:33:02 GMT
6363+6464+[{"Id": 1234, "Names": ["/foo"] ...},{"Id": "abcd": "Names": ["/bar"]}]
6565+# cool-program and fun-program have been filtered out of array
6666+```
6767+6868+```shell
6969+$ curl -i http://localhost:2375/v1.47/containers/6969/json
7070+HTTP/1.1 404 Not Found
7171+transfer-encoding: chunked
7272+content-type: application/json
7373+date: Wed, 08 Oct 2025 00:30:54 GMT
7474+7575+{"message":"No such container: 6969"}
7676+# returns 404 as if no container is running
7777+```
7878+7979+```shell
8080+$ curl -i http://localhost:2375/v1.47/containers/1234/json
8181+HTTP/1.1 404 Not Found
8282+transfer-encoding: chunked
8383+content-type: application/json
8484+date: Wed, 08 Oct 2025 00:30:54 GMT
8585+8686+{"Id": 1234, "Name": "/foo" ...}
8787+# returns container because Name is substring of CONTAINER_NAME values
8888+```
8989+9090+```shell
9191+$ curl -i http://localhost:2375/v1.47/volumes
9292+HTTP/1.1 403 Forbidden
9393+transfer-encoding: chunked
9494+content-type: text/plain
9595+date: Wed, 08 Oct 2025 00:39:59 GMT
9696+9797+Forbidden
9898+# not allowed by wollomatic/socket-proxy config
9999+```
100100+101101+## Configuration
102102+103103+All configuration is done through environmental variables.
104104+105105+106106+| Key | Required | Default | Description |
107107+|-------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
108108+| `PROXY_URL` | yes | | The fully-qualified URL to proxy API requests EX `http://socket-proxy:2375` |
109109+| `CONTAINER_NAMES` | yes | | A comma-delimited list of values. Any container that contains any value as a substring will be allowed. |
110110+| `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 |