Skip to content

Instantly share code, notes, and snippets.

@khorevaa
Created March 2, 2022 06:33
Show Gist options
  • Save khorevaa/e3b637aee350d52c68ec72039273b821 to your computer and use it in GitHub Desktop.
Save khorevaa/e3b637aee350d52c68ec72039273b821 to your computer and use it in GitHub Desktop.
docker-ssh-socket-tunnel
- eval $(ssh-agent -s)
- ssh-add <(echo "${SSH_PRIVATE_KEY}")
- REMOTE=${STAGING_REMOTE:?Необходим STAGING_REMOTE}
- REMOTE_PORT=${STAGING_REMOTE_PORT:?Необходим STAGING_REMOTE_PORT}
- echo " * OPENING DOCKER SOCKET TUNNEL"
- |
socat \
"UNIX-LISTEN:/tmp/docker.sock,reuseaddr,fork" \
"EXEC:'ssh -o StrictHostKeyChecking=no -kTax $REMOTE -p $REMOTE_PORT socat STDIO UNIX-CONNECT\:/var/run/docker.sock'" \
&
export DOCKER_HOST=unix:///tmp/docker.sock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment