Skip to content

Commit 7fd17fa

Browse files
Add NET_ADMIN documentation (#2348)
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
1 parent 183fe19 commit 7fd17fa

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

caddy/content.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $ docker run -d -p 80:80 \
4949
The default `Caddyfile` only listens to port `80`, and does not set up automatic TLS. However, if you have a domain name for your site, and its A/AAAA DNS records are properly pointed to this machine's public IP, then you can use this command to simply serve a site over HTTPS:
5050

5151
```console
52-
$ docker run -d -p 80:80 -p 443:443 -p 443:443/udp \
52+
$ docker run -d --cap-add=NET_ADMIN -p 80:80 -p 443:443 -p 443:443/udp \
5353
-v /site:/srv \
5454
-v caddy_data:/data \
5555
-v caddy_config:/config \
@@ -109,6 +109,14 @@ $ caddy_container_id=$(docker ps | grep caddy | awk '{print $1;}')
109109
$ docker exec -w /etc/caddy $caddy_container_id caddy reload
110110
```
111111

112+
### Linux capabilities
113+
114+
Caddy ships with HTTP/3 support enabled by default. To improve the performance of this UDP based protocol, the underlying quic-go library tries to increase the buffer sizes for its socket. The `NET_ADMIN` capability allows it to override the low default limits of the operating system without having to change kernel parameters via sysctl.
115+
116+
Giving the container this capability is optional and has potential, though unlikely, to have [security implications](https://unix.stackexchange.com/a/508816).
117+
118+
See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for more details.
119+
112120
### Docker Compose example
113121

114122
If you prefer to use `docker-compose` to run your stack, here's a sample service definition.
@@ -120,6 +128,8 @@ services:
120128
caddy:
121129
image: %%IMAGE%%:<version>
122130
restart: unless-stopped
131+
cap_add:
132+
- NET_ADMIN
123133
ports:
124134
- "80:80"
125135
- "443:443"

0 commit comments

Comments
 (0)