Github repo - https://github.com/oleksdovz/dcr-socat
This Docker image provides a simple way to set up a TCP proxy using socat. It enables traffic forwarding between a source port on the host machine and a destination IP and port, which can be another machine or service.
The primary purpose of this image is to serve as a TCP proxy, allowing users to forward network traffic from a specified source port to a target IP and port. This can be helpful in various scenarios, such as:
The following environment variables can be set to customize the behavior of the socat proxy:
SOURCE_PORT: The port on the host machine that socat will listen on for incoming connections.DEST_PORT: The port on the destination machine that socat will forward traffic to.DEST_IP: The IP address of the destination machine that socat will forward traffic to.Build the Docker Image: If you haven't already built the image, you can do so with the following command:
docker build -t socat-proxy .
Run the Container You can start the container by using docker run and setting the necessary environment variables. This example demonstrates setting up a proxy that listens on SOURCE_PORT and forwards to DEST_IP:DEST_PORT.
docker run -e SOURCE_PORT=8080 -e DEST_PORT=9090 -e DEST_IP=192.168.0.20 socat-proxy
MySQL Use Case Example To connect to a MySQL server on a remote machine from your local machine, you can forward a local port (3306) to the remote MySQL port (3306) using socat.
docker run -e SOURCE_PORT=3306 -e DEST_PORT=3306 -e DEST_IP=192.168.1.100 socat-proxy
With the proxy running, you can now connect to MySQL as if it were running on your local machine:
mysql -h 127.0.0.1 -P 3306 -u your_username -p
This command connects to the MySQL server on 192.168.1.100:3306 through the local port 3306, allowing you to work with the remote MySQL instance as if it were local.
Content type
Image
Digest
sha256:cf1d6e67a…
Size
4 MB
Last updated
over 1 year ago
docker pull odovzh/socat