Skip to content

Instantly share code, notes, and snippets.

@hivelogic2018
Created August 4, 2025 13:06
Show Gist options
  • Select an option

  • Save hivelogic2018/1484409591358f60929ba3644ef71964 to your computer and use it in GitHub Desktop.

Select an option

Save hivelogic2018/1484409591358f60929ba3644ef71964 to your computer and use it in GitHub Desktop.
Caprover NET_ADMIN line in its Docker command

The NET_ADMIN capability in this Docker Compose file:

cap_add:
  - NET_ADMIN

is a Linux capability that grants the container elevated privileges to manage network-related operations. It's one of many fine-grained permissions that containers can be granted in a secure way, without giving them full root access.

🧠 What does NET_ADMIN do?

It allows the container to perform actions like:

  • Configure network interfaces (e.g. ip addr, ifconfig, etc.)
  • Set up routes
  • Modify firewall rules (e.g. iptables)
  • Create virtual network devices (e.g. tun, tap)
  • Use tools like tc (traffic control)

🛠 Why does CapRover need NET_ADMIN?

CapRover uses Docker's internal networking to route traffic to deployed apps and sometimes configures things like custom firewall rules or manages ports behind the scenes. The NET_ADMIN capability is required for:

  • Handling reverse proxy configurations
  • Managing firewall/NAT rules for internal/external app exposure
  • Possibly configuring iptables when setting up SSL or routing

Without NET_ADMIN, some of those network-level operations might fail inside the container, breaking CapRover’s ability to route traffic correctly or bind services.


⚠️ Security Note

Granting NET_ADMIN gives the container significant control over the host’s network stack. It should only be used with trusted images, like caprover/caprover, which is a well-maintained project. Avoid using this flag in random or third-party images unless absolutely necessary.

Let me know if you want to run CapRover without NET_ADMIN and work around it with host networking or adjusted Docker privileges — it’s possible in some use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment