与远端主机建立隧道,可通过远端主机访问本地服务
Put your private key (id_rsa) to ~/.ssh folder.
Now in docker-compose.yml you can define the tunnel as follows:
version: '2'
services:
mysql:
image: ace1573/docker-tunnel-jump
volumes:
- $HOME/.ssh:/root/ssh:ro
environment:
SSH_DEBUG: "-v"
TUNNEL_HOST: tunnel-host
REMOTE_HOST: ssh-tunnel.corporate.tld
LOCAL_PORT: 3306
REMOTE_PORT: 3306
network_mode: host
restart: always
docker-compose up -dAfter you start up docker containers, any container in the same container network will be able to access to tunneled mysql instance using tcp://tunnel-host:3306.
Content type
Image
Digest
sha256:1df280273…
Size
4.3 MB
Last updated
almost 4 years ago
docker pull ace1573/ssh-tunnel-jump