Created
March 2, 2022 06:33
-
-
Save khorevaa/e3b637aee350d52c68ec72039273b821 to your computer and use it in GitHub Desktop.
docker-ssh-socket-tunnel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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