mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-11 10:50:35 -05:00
[GH-ISSUE #376] Consider Alternatives to exposing ports to Gerbil in Docker Compose #38212
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bannert1337 on GitHub (Mar 21, 2025).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/376
Currently, to create a raw TCP/UDP resource the user has to manually expose ports to Gerbil in the Docker Compose.
This is cumbersome and error-prone.
An alternative could be to use network mode
hostfor Gerbil.Pros of using
network mode: hostfor Gerbil:Cons of using
network mode: hostfor Gerbil:network mode: hostsignificantly reduces network isolation. Gerbil will share the host machine's network namespace, meaning it can bind to any port on the host and could potentially interact with other services running directly on the host. This might be undesirable from a security perspective, especially in shared environments.network mode: hostgoes against the typical best practices of containerization, which emphasize process and network isolation. It makes the container less self-contained and more tightly coupled to the host environment.network mode: hostcould lead to unexpected interactions or dependencies on the host's network configuration, making the system less portable and predictable across different host environments.@bannert1337 commented on GitHub (Mar 21, 2025):
Alternative 2: Dynamic Port Allocation and Container Orchestration
Instead of
network mode: host, Gerbil could be modified to dynamically request ports from the Docker daemon or an orchestrator (like Docker Swarm or Kubernetes, if Pangolin aims for broader deployment strategies).Pros of Dynamic Port Allocation:
Cons of Dynamic Port Allocation:
@bannert1337 commented on GitHub (Mar 21, 2025):
Alternative 3: Dedicated Proxy Container within a Docker Network
Keep Gerbil in a standard Docker bridge network or a dedicated network. Introduce a separate, lightweight "proxy" container within the same network. This proxy container would be responsible for exposing the ports to the host. Gerbil would configure this proxy container via an internal network communication mechanism.
Pros of Dedicated Proxy Container:
socat,nginx stream, a simple custom proxy).Cons of Dedicated Proxy Container:
@bannert1337 commented on GitHub (Mar 21, 2025):
Alternative 4: Docker Socket Communication (Advanced)
Gerbil could potentially interact directly with the Docker daemon (through the Docker socket, or a more secure socket proxy) to request and manage port mappings programmatically.
Pros of Docker Socket Communication:
Cons of Docker Socket Communication:
@bannert1337 commented on GitHub (Mar 21, 2025):
Related to #375
@strich3 commented on GitHub (Mar 22, 2025):
With that maybe the option of adding port ranges could be very useful!