Relays TCP connections from a local port to another host and port with socat. Useful to expose a service under a different port or to reach something outside the cluster through a Service.
# Arguments: target host and port (listens on the same port)
docker run --rm -p 5432:5432 ghcr.io/tuxpeople/tcp-proxy:latest db.example.com 5432
# Or environment variables, with a different listen port
docker run --rm -p 8080:8080 \
-e TARGET_HOST=example.com -e TARGET_PORT=80 -e LISTEN_PORT=8080 \
ghcr.io/tuxpeople/tcp-proxy:latest
| Variable | Description |
|---|---|
TARGET_HOST | Host to relay to (or first argument) |
TARGET_PORT | Port to relay to (or second argument) |
LISTEN_PORT | Local port, defaults to TARGET_PORT |
Runs as UID 1001: use a LISTEN_PORT above 1024 or grant NET_BIND_SERVICE.
1.1.1X.Y.Z, X.Y, X, latesttest.sh starts an HTTP backend and the proxy in front of it and fetches a page through the proxy:
docker build -t tcp-proxy:test .
./test.sh tcp-proxy:test
docker pull tdeutsch/tcp-proxy:latest