https://github.com/christopher-ramirez/port-forwarder
Docker container for forwarding connections to an external host
https://github.com/christopher-ramirez/port-forwarder
docker forwarder networking port-forwarding
Last synced: 29 days ago
JSON representation
Docker container for forwarding connections to an external host
- Host: GitHub
- URL: https://github.com/christopher-ramirez/port-forwarder
- Owner: christopher-ramirez
- License: mit
- Created: 2019-05-29T20:55:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-29T22:09:24.000Z (about 7 years ago)
- Last Synced: 2025-10-09T21:43:15.738Z (8 months ago)
- Topics: docker, forwarder, networking, port-forwarding
- Language: Shell
- Size: 2.93 KB
- Stars: 5
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Docker Port forwarder
Container for forwarding incoming traffic in one port to an external server.
Since the container works with iptables to set up the traffic forwarding,
it requires the **`NET_ADMIN`** privilege.
The forwarding configuration is set up with environment variables.
These variables define the listening port and the destination server
and optionally, the destination port for the incoming traffic.
### Environment Variables for setting up traffic forwarding
|Variable|Description|
|---|---|
|PORT|Source port of incoming traffic|
|FORWARD_TO|Destination server IP or hostname to forward traffic to|
|FORWARD_TO_PORT|(optional) Destination port where to forward traffic on the destination server. When not defined, it defaults to the same value of $PORT|
|PROTOCOL|(optional) Protocol to use. Default to *tcp*
### Examples
``` sh
docker run --name port_forwarder \
--cap-add=NET_ADMIN \
-p 80:80 \
-e PORT=80 \
-e FORWARD_TO=private.server.com \
-e FORWARD_TO_PORT=8080 \
topherafa/port-forwarder
```
Creates a container that forwards incoming traffic in port *80*, to port *8080* on `private.server.com`.