Skip to content

Instantly share code, notes, and snippets.

@misraX
Last active August 11, 2017 12:11
Show Gist options
  • Save misraX/fca0c30412c441d269fed4855efbc665 to your computer and use it in GitHub Desktop.
Save misraX/fca0c30412c441d269fed4855efbc665 to your computer and use it in GitHub Desktop.
Exposing TCP Ports Using Socat's Container
#!/bin/bash
###
# socat container to forward tcp ports from system wide running containers or network services
###
# Define the ip
ip=172.17.0.2
# Define port number
port=8080
# Running socat container to forward the service using it's ip and port number
docker run -ti --rm --net host bobrik/socat TCP4-LISTEN:$(port) TCP4:$(ip):$(port)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment