@scripties/docker-port-forward
v0.1.2
Published
Publish a temporary local TCP port to a running Docker container using a socat sidecar.
Maintainers
Readme
docker-port-forward
Small CLI that exposes a temporary TCP port on the host to a running Docker container by starting an alpine/socat sidecar on the same Docker network.
Requirements: Docker Engine API reachable locally, Node.js ≥ 20.
Install
npm install -g docker-port-forwardUsage
docker-port-forward --container my-app --container-port 8080Ctrl+Cstops the sidecar and exits.- If the sidecar container exits on its own, the CLI exits after that.
Interactive mode
Pick a running container and port from prompts:
docker-port-forward --interactiveCommon options
| Option | Description |
|--------|-------------|
| -c, --container | Target container name or ID |
| -p, --container-port | TCP port inside the target container |
| -i, --interactive | Prompt for container and port |
| --host-port | Host port (omit for an ephemeral port) |
| --bind | Host IP for the publish (default 127.0.0.1; use 0.0.0.0 for all interfaces) |
| --network | Docker network name when the target has several networks |
docker-port-forward --helpDevelopment
npm install
npm run build
node dist/cli.js --helpLicense
MIT
