Created
April 20, 2023 11:14
-
-
Save victor141516/69d7f5a334cff7a9b9dc176e4deaae92 to your computer and use it in GitHub Desktop.
Traffic forwarding Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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