github.com/mirantis/virtlet@v1.5.2-0.20191204181327-1659b8a48e9b/build/portforward.sh (about) 1 #!/bin/bash 2 # Portforward hack for CircleCI remote docker 3 set -o errexit 4 set -o nounset 5 set -o pipefail 6 set -o errtrace 7 8 if [[ ${1:-} = start ]]; then 9 docker run -d -it \ 10 --name portforward --net=host \ 11 --entrypoint /bin/sh \ 12 bobrik/socat -c "while true; do sleep 1000; done" 13 elif [[ ${1} ]]; then 14 socat "TCP-LISTEN:${1},reuseaddr,fork" \ 15 EXEC:"'docker exec -i portforward socat STDIO TCP-CONNECT:localhost:${1}'" 16 else 17 echo "Must specify either start or the port number" >&2 18 exit 1 19 fi