/docker-for-mac-host-bridge

Emulate docker0 bridge for docker-for-mac

Primary LanguageDockerfileMIT LicenseMIT

README

Emulate docker0 bridge for docker-for-mac

⚠️ This project is no longer maintained. ⚠️

Installation

This project works with socat and sshuttle. These dependencies can be installed with brew:

brew install socat

brew install sshuttle

Usage

# Start ssh server

docker run --name host-bridge --net host --read-only --rm --tmpfs /run:exec --volume ${HOME}/.ssh/id_rsa.pub:/root/.ssh/authorized_keys:ro mauchede/docker-for-mac-host-bridge:latest

# Start socat forwarding

socat TCP-LISTEN:22,reuseaddr,fork "EXEC:docker exec -i host-bridge 'socat STDIO TCP-CONNECT:127.0.0.1:22'"

# Start sshuttle

sshuttle --remote root@127.0.0.1 --ssh-cmd 'ssh -i ${HOME}/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' 172.17.0.0/8 192.168.65.0/24

Note: socat is mandatory because port forwarding is not allowed when a container uses --net host.

Links