how to let docker container work with sshuttle? how to let docker container work with sshuttle? docker docker

how to let docker container work with sshuttle?


Try sshuttle -l 0.0.0.0 --dns -vvr XXXXXX@YY.YY.YY.YY 0/0, that works for me. I guess we need -l 0.0.0.0 so that docker containers with "remote ip" can connect to the tunnel.


Normally, setting 0.0.0.0 entails listening on externally available interfaces, and this is also the case with sshuttle .

A more secure approach would be the following - on your host:

  1. launch your "normal" sshuttle instance, listening on localhost,
  2. launch another sshuttle instance, listening on your docker host's virtual network interface.

For example:

sshuttle --dns -r <your-ssh-server> 0/0sshuttle -l 172.17.0.1 --dns -r <your-ssh-server> 0/0

Note that this will interfere with host <-> container communication (such as port binding), but it will allow for secure outside connections for your containers (you can further help yourself with excluding Docker's subnet, e.g. with -x 172.17.0.0/24).


you can see your network bridge subnets and exclude it in sshuttlee.g,

sudo sshuttle -l 0.0.0.0:0 -r user@host -x host -x 127.0.0.1 -x 172.21.0.0/24 -x 172.22.0.0/24 -x 172.23.0.0/24 0/0 --dns