Skip to content

Commit b5d80f0

Browse files
committed
2 parents aa6c646 + 37d7e1e commit b5d80f0

File tree

1 file changed

+126
-41
lines changed

1 file changed

+126
-41
lines changed

README.md

Lines changed: 126 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![banner](https://github.com/11notes/defaults/blob/main/static/img/banner.png?raw=true)
22

33
# SOCKET-PROXY
4-
![size](https://img.shields.io/docker/image-size/11notes/socket-proxy/2.1.3?color=0eb305)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)![version](https://img.shields.io/docker/v/11notes/socket-proxy/2.1.3?color=eb7a09)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)![pulls](https://img.shields.io/docker/pulls/11notes/socket-proxy?color=2b75d6)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)[<img src="https://img.shields.io/github/issues/11notes/docker-SOCKET-PROXY?color=7842f5">](https://github.com/11notes/docker-SOCKET-PROXY/issues)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)![swiss_made](https://img.shields.io/badge/Swiss_Made-FFFFFF?labelColor=FF0000&logo=data:image/svg%2bxml;base64,PHN2ZyB2ZXJzaW9uPSIxIiB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0idHJhbnNwYXJlbnQiLz4KICA8cGF0aCBkPSJtMTMgNmg2djdoN3Y2aC03djdoLTZ2LTdoLTd2LTZoN3oiIGZpbGw9IiNmZmYiLz4KPC9zdmc+)
4+
![size](https://img.shields.io/docker/image-size/11notes/socket-proxy/2.1.4?color=0eb305)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)![version](https://img.shields.io/docker/v/11notes/socket-proxy/2.1.4?color=eb7a09)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)![pulls](https://img.shields.io/docker/pulls/11notes/socket-proxy?color=2b75d6)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)[<img src="https://img.shields.io/github/issues/11notes/docker-SOCKET-PROXY?color=7842f5">](https://github.com/11notes/docker-SOCKET-PROXY/issues)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)![swiss_made](https://img.shields.io/badge/Swiss_Made-FFFFFF?labelColor=FF0000&logo=data:image/svg%2bxml;base64,PHN2ZyB2ZXJzaW9uPSIxIiB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0idHJhbnNwYXJlbnQiLz4KICA8cGF0aCBkPSJtMTMgNmg2djdoN3Y2aC03djdoLTZ2LTdoLTd2LTZoN3oiIGZpbGw9IiNmZmYiLz4KPC9zdmc+)
55

66
Access your docker socket safely as read-only, rootless and distroless
77

@@ -19,82 +19,165 @@ socket-proxy-1 | user: "0:991"
1919
```
2020

2121
# UNIQUE VALUE PROPOSITION 💶
22-
**Why should I run this image and not the other image(s) that already exist?** Good question! All the other images on the market that do exactly the same don’t do or offer these options:
22+
**Why should I run this image and not the other image(s) that already exist?** Good question! Because ...
2323

2424
> [!IMPORTANT]
25-
>* This image runs the proxy part as a specific UID/GID (not root), most other images run everything as root
26-
>* This image uses a single binary, most other images use apps like Nginx or HAProxy (bloat)
27-
>* This image has no shell since it is 100% distroless, most other images run on a distro like Debian or Alpine with full shell access (security)
28-
>* This image does not ship with any critical or high rated CVE and is automatically maintained via CI/CD, most other images mostly have no CVE scanning or code quality tools in place
29-
>* This image is created via a secure, pinned CI/CD process and immune to upstream attacks, most other images have upstream dependencies that can be exploited
30-
>* This image contains a proper health check that verifies the app is actually working, most other images have either no health check or only check if a port is open or ping works
31-
>* This image exposes the socket as a UNIX socket and TCP socket, most other images only expose it via a TCP socket
32-
>* This image works as read-only, most other images need to write files to the image filesystem
25+
>* ... this image exposes the socket not as root but as 1000:1000
26+
>* ... this image has no shell since it is [distroless](https://github.com/11notes/RTFM/blob/main/linux/container/image/distroless.md)
27+
>* ... this image is auto updated to the latest version via CI/CD
28+
>* ... this image has a health check
29+
>* ... this image runs read-only
30+
>* ... this image is automatically scanned for CVEs before and after publishing
31+
>* ... this image is created via a secure and pinned CI/CD process
32+
>* ... this image is very small
3333
34-
If you value security, simplicity and the ability to interact with the maintainer and developer of an image. Using my images is a great start in that direction.
34+
If you value security, simplicity and optimizations to the extreme, then this image might be for you.
3535

3636
# COMPOSE ✂️
3737
```yaml
38-
name: "traefik"
38+
name: "reverse-proxy"
3939
services:
4040
socket-proxy:
41-
image: "11notes/socket-proxy:2.1.3"
41+
# this image is used to expose the docker socket as read-only to traefik
42+
# you can check https://github.com/11notes/docker-socket-proxy for all details
43+
image: "11notes/socket-proxy:2.1.4"
4244
read_only: true
43-
# make sure to use the same UID/GID as the owner of your docker socket!
44-
user: "0:0"
45+
user: "0:108"
46+
environment:
47+
TZ: "Europe/Zurich"
4548
volumes:
46-
# mount host docker socket, the :ro does not mean read-only for the socket, just for the actual file
47-
- "/run/docker.sock:/run/docker.sock:ro"
48-
# this socket is run as 1000:1000, not as root!
49-
- "socket-proxy:/run/proxy"
49+
- "/run/docker.sock:/run/docker.sock:ro"
50+
- "socket-proxy.run:/run/proxy"
5051
restart: "always"
5152

5253
traefik:
53-
image: "11notes/traefik:3.2.0"
5454
depends_on:
5555
socket-proxy:
5656
condition: "service_healthy"
5757
restart: true
58+
image: "11notes/traefik:3.5.0"
59+
read_only: true
60+
labels:
61+
- "traefik.enable=true"
62+
63+
# default errors middleware
64+
- "traefik.http.middlewares.default-errors.errors.status=402-599"
65+
- "traefik.http.middlewares.default-errors.errors.query=/{status}"
66+
- "traefik.http.middlewares.default-errors.errors.service=default-errors"
67+
68+
# default ratelimit
69+
- "traefik.http.middlewares.default-ratelimit.ratelimit.average=100"
70+
- "traefik.http.middlewares.default-ratelimit.ratelimit.burst=120"
71+
- "traefik.http.middlewares.default-ratelimit.ratelimit.period=1s"
72+
73+
# default CSP
74+
- "traefik.http.middlewares.default-csp.headers.contentSecurityPolicy=default-src 'self' blob: data: 'unsafe-inline'"
75+
76+
# default allowlist
77+
- "traefik.http.middlewares.default-ipallowlist-RFC1918.ipallowlist.sourcerange=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
78+
79+
# example on how to secure the traefik dashboard and api
80+
- "traefik.http.routers.dashboard.rule=Host(`${TRAEFIK_FQDN}`)"
81+
- "traefik.http.routers.dashboard.service=api@internal"
82+
- "traefik.http.routers.dashboard.middlewares=dashboard-auth"
83+
- "traefik.http.routers.dashboard.entrypoints=https"
84+
# admin / traefik, please change!
85+
- "traefik.http.middlewares.dashboard-auth.basicauth.users=admin:$2a$12$ktgZsFQZ0S1FeQbI1JjS9u36fAJMHDQaY6LNi9EkEp8sKtP5BK43C"
86+
87+
# default catch-all router
88+
- "traefik.http.routers.default.rule=HostRegexp(`.+`)"
89+
- "traefik.http.routers.default.priority=1"
90+
- "traefik.http.routers.default.entrypoints=https"
91+
- "traefik.http.routers.default.service=default-errors"
92+
93+
# default http to https redirection
94+
- "traefik.http.middlewares.default-http.redirectscheme.permanent=true"
95+
- "traefik.http.middlewares.default-http.redirectscheme.scheme=https"
96+
- "traefik.http.routers.default-http.priority=1"
97+
- "traefik.http.routers.default-http.rule=HostRegexp(`.+`)"
98+
- "traefik.http.routers.default-http.entrypoints=http"
99+
- "traefik.http.routers.default-http.middlewares=default-http"
100+
- "traefik.http.routers.default-http.service=default-http"
101+
- "traefik.http.services.default-http.loadbalancer.passhostheader=true"
102+
environment:
103+
TZ: "Europe/Zurich"
58104
command:
105+
# ping is needed for the health check to work!
106+
- "--ping=true"
107+
- "--ping.terminatingStatusCode=204"
59108
- "--global.checkNewVersion=false"
60109
- "--global.sendAnonymousUsage=false"
110+
- "--accesslog=true"
61111
- "--api.dashboard=true"
62-
- "--api.insecure=true"
112+
# disable insecure api and dashboard access
113+
- "--api.insecure=false"
63114
- "--log.level=INFO"
64115
- "--log.format=json"
65116
- "--providers.docker.exposedByDefault=false"
117+
- "--providers.file.directory=/traefik/var"
66118
- "--entrypoints.http.address=:80"
119+
- "--entrypoints.http.http.middlewares=default-errors,default-ratelimit,default-ipallowlist-RFC1918,default-csp"
67120
- "--entrypoints.https.address=:443"
121+
- "--entrypoints.https.http.tls=true"
122+
- "--entrypoints.https.http.middlewares=default-errors,default-ratelimit,default-ipallowlist-RFC1918,default-csp"
123+
# disable upstream HTTPS certificate checks (https > https)
68124
- "--serversTransport.insecureSkipVerify=true"
125+
- "--experimental.plugins.rewriteResponseHeaders.moduleName=github.com/jamesmcroft/traefik-plugin-rewrite-response-headers"
126+
- "--experimental.plugins.rewriteResponseHeaders.version=v1.1.2"
127+
- "--experimental.plugins.geoblock.moduleName=github.com/PascalMinder/geoblock"
128+
- "--experimental.plugins.geoblock.version=v0.3.3"
69129
ports:
70130
- "80:80/tcp"
71131
- "443:443/tcp"
72-
- "8080:8080/tcp"
132+
volumes:
133+
- "var:/traefik/var"
134+
- "plugins:/traefik/plugins"
135+
# access docker socket via proxy read-only
136+
- "socket-proxy.run:/var/run"
73137
networks:
74-
frontend:
75138
backend:
76-
volumes:
77-
- "socket-proxy:/var/run"
139+
frontend:
78140
sysctls:
141+
# allow rootless container to access ports < 1024
79142
net.ipv4.ip_unprivileged_port_start: 80
80143
restart: "always"
81144

82-
nginx: # example container
83-
image: "11notes/nginx:1.26.2"
145+
errors:
146+
# this image can be used to display a simple error message since Traefik can’t serve content
147+
image: "11notes/traefik:errors"
148+
read_only: true
84149
labels:
85150
- "traefik.enable=true"
86-
- "traefik.http.routers.default.priority=1"
87-
- "traefik.http.routers.default.rule=PathPrefix(`/`)"
88-
- "traefik.http.routers.default.entrypoints=http"
89-
- "traefik.http.routers.default.service=default"
90-
- "traefik.http.services.default.loadbalancer.server.port=8443"
91-
- "traefik.http.services.default.loadbalancer.server.scheme=https" # proxy from http to https since this image runs by default on https
151+
- "traefik.http.services.default-errors.loadbalancer.server.port=8080"
152+
environment:
153+
TZ: "Europe/Zurich"
92154
networks:
93-
backend: # allow container only to be accessed via traefik
155+
backend:
156+
restart: "always"
157+
158+
# example container
159+
nginx:
160+
image: "11notes/nginx:stable"
161+
read_only: true
162+
labels:
163+
- "traefik.enable=true"
164+
- "traefik.http.routers.nginx-example.rule=Host(`${NGINX_FQDN}`)"
165+
- "traefik.http.routers.nginx-example.entrypoints=https"
166+
- "traefik.http.routers.nginx-example.service=nginx-example"
167+
ports:
168+
- "3000:3000/tcp"
169+
tmpfs:
170+
# needed for read_only: true
171+
- "/nginx/cache:uid=1000,gid=1000"
172+
- "/nginx/run:uid=1000,gid=1000"
173+
networks:
174+
backend:
94175
restart: "always"
95176

96177
volumes:
97-
socket-proxy:
178+
var:
179+
plugins:
180+
socket-proxy.run:
98181

99182
networks:
100183
frontend:
@@ -111,22 +194,24 @@ networks:
111194
| `SOCKET_PROXY_DOCKER_SOCKET` | path to the actual docker socket | /run/docker.sock |
112195
| `SOCKET_PROXY_UID` | the UID used to run the proxy parts | 1000 |
113196
| `SOCKET_PROXY_GID` | the GID used to run the proxy parts | 1000 |
197+
| `SOCKET_PROXY_KEEPALIVE` | connection keep alive interval to SOCKET_PROXY_DOCKER_SOCKET | 10s |
198+
| `SOCKET_PROXY_TIMEOUT` | connection max. timeout to SOCKET_PROXY_DOCKER_SOCKET | 30s |
114199

115200
# MAIN TAGS 🏷️
116201
These are the main tags for the image. There is also a tag for each commit and its shorthand sha256 value.
117202

118-
* [2.1.3](https://hub.docker.com/r/11notes/socket-proxy/tags?name=2.1.3)
203+
* [2.1.4](https://hub.docker.com/r/11notes/socket-proxy/tags?name=2.1.4)
119204

120205
### There is no latest tag, what am I supposed to do about updates?
121-
It is of my opinion that the ```:latest``` tag is dangerous. Many times, I’ve introduced **breaking** changes to my images. This would have messed up everything for some people. If you don’t want to change the tag to the latest [semver](https://semver.org/), simply use the short versions of [semver](https://semver.org/). Instead of using ```:2.1.3``` you can use ```:2``` or ```:2.1```. Since on each new version these tags are updated to the latest version of the software, using them is identical to using ```:latest``` but at least fixed to a major or minor version.
206+
It is of my opinion that the ```:latest``` tag is dangerous. Many times, I’ve introduced **breaking** changes to my images. This would have messed up everything for some people. If you don’t want to change the tag to the latest [semver](https://semver.org/), simply use the short versions of [semver](https://semver.org/). Instead of using ```:2.1.4``` you can use ```:2``` or ```:2.1```. Since on each new version these tags are updated to the latest version of the software, using them is identical to using ```:latest``` but at least fixed to a major or minor version.
122207

123208
If you still insist on having the bleeding edge release of this app, simply use the ```:rolling``` tag, but be warned! You will get the latest version of the app instantly, regardless of breaking changes or security issues or what so ever. You do this at your own risk!
124209

125210
# REGISTRIES ☁️
126211
```
127-
docker pull 11notes/socket-proxy:2.1.3
128-
docker pull ghcr.io/11notes/socket-proxy:2.1.3
129-
docker pull quay.io/11notes/socket-proxy:2.1.3
212+
docker pull 11notes/socket-proxy:2.1.4
213+
docker pull ghcr.io/11notes/socket-proxy:2.1.4
214+
docker pull quay.io/11notes/socket-proxy:2.1.4
130215
```
131216
132217
# SOURCE 💾
@@ -148,4 +233,4 @@ docker pull quay.io/11notes/socket-proxy:2.1.3
148233
# ElevenNotes™️
149234
This image is provided to you at your own risk. Always make backups before updating an image to a different version. Check the [releases](https://github.com/11notes/docker-socket-proxy/releases) for breaking changes. If you have any problems with using this image simply raise an [issue](https://github.com/11notes/docker-socket-proxy/issues), thanks. If you have a question or inputs please create a new [discussion](https://github.com/11notes/docker-socket-proxy/discussions) instead of an issue. You can find all my other repositories on [github](https://github.com/11notes?tab=repositories).
150235
151-
*created 16.07.2025, 11:33:32 (CET)*
236+
*created 07.08.2025, 08:25:43 (CET)*

0 commit comments

Comments
 (0)