Skip to content

Instantly share code, notes, and snippets.

@victor141516
Created April 20, 2023 11:14
Show Gist options
  • Save victor141516/69d7f5a334cff7a9b9dc176e4deaae92 to your computer and use it in GitHub Desktop.
Save victor141516/69d7f5a334cff7a9b9dc176e4deaae92 to your computer and use it in GitHub Desktop.
Traffic forwarding Docker
#!/bin/sh
function forward_container() {
docker run -it --rm \
-p $OUTSIDE_PORT:$INSIDE_PORT \
--network $NETWORK_NAME \
alpine/socat \
tcp-listen:$INSIDE_PORT,fork,reuseaddr tcp-connect:$CONTAINER_NAME:$INSIDE_PORT
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment