Cannot access docker internal network from the host

Hello everyone,

I’ve created a container with my customized network (named internet) which has access to the internet. then I installed my packages and run the ssh server, I could easily access the container using the (I used -p 22:22) but the problem is after I install my packages I would like to disconnect the machine from the internet and use “no_internet” network, but when I want to reconnect to I am getting connection refused! it seems it’s not accessible by the host!

C:\Users\myuser>docker network disconnect bridge test

C:\Users\myuser>docker network connect internet test

C:\Users\myuser>ssh root@
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:1+PgH8ufz/6AshCvHBDTWoKSyAxT+622wI/F2IBs5/E.
Are you sure you want to continue connecting (yes/no)?

C:\Users\myuser>docker network disconnect internet test

C:\Users\myuser>docker network connect no_internet test

C:\Users\myuser>ssh root@
ssh: connect to host port 22: Connection refused
  • I used this command to create the “internet” network.
docker network create internet  --opt --opt --opt --opt
  • I used this command to create “no_internet” network.
docker network create --internal no_internet  --opt --opt --opt --opt
  • I restart the ssh service to check if it fixes it but it didn’t!

a simple solution

I can create a virtual machine and connect both internet and internal network into it, then use the port forwarding with iptables to access the internal network!

1- sshserver = (internal)
2- machine =, (internal, internet)
3- host =>>>, internet, internal, internal)

but this solution is odd, maybe someone with more docker knowledge could help?

Best Regards.