docker-archive / toolbox

The Docker Toolbox
https://docker.com/toolbox
3.22k stars 1.23k forks source link

How to use Docker VirtualBox with VPN and Proxy? #899

Open mikezang opened 4 years ago

mikezang commented 4 years ago

I use company Windows 7 PC at home and installed Docker version 19.03.1, build 74b1e89e8a with VirtualBox, I can use home Wi-Fi but I can't connect to Internet, I have to use company VPN with Proxy to access Internet. When I connect to VPN and PROXY and start Docker Quickstart Terminal, I got message as below:

Starting "default"... (default) Check network to re-create if needed... (default) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar. (default) Waiting for an IP... Machine "default" was started. Waiting for SSH to be available... Detecting the provisioner... Started machines may have new IP addresses. You may need to re-run the docker-machine env command. Regenerate TLS machine certs? Warning: this is irreversible. (y/n): Regenerating TLS certificates Waiting for SSH to be available... Detecting the provisioner... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon... This machine has been allocated an IP address, but Docker Machine could not reach it successfully. SSH for the machine should still work, but connecting to exposed ports, such as the Docker daemon port (usually :2376), may not work properly. You may need to add the route manually, or use another related workaround. This could be due to a VPN, proxy, or host file configuration issue. You also might want to clear any VirtualBox host only interfaces you are not using. Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": dial tcp 192.168.99.100:2376: connectex: No connection could be made because the target machine actively refused it. You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'. Be advised that this will trigger a Docker daemon restart which might stop running containers. Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": dial tcp 192.168.99.100:2376: connectex: No connection could be made because the target machine actively refused it. You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'. Be advised that this will trigger a Docker daemon restart which might stop running containers.

.

==

===

/"""""""""""""""""___/ ===


\______ o           __/
\    \         __/
\____\_______/
docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com
Start interactive shell

docker-machine ls show as below:

NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default * virtualbox Running tcp://192.168.99.100:2376 Unknown Unable to query docker version: Get https://192.168.99.100:2376/v1.15/version: dial tcp 192.168.99.100:2376: connectex: No connection could be made because the target machine actively refused it.

docker run hello-world will show as below:

C:\Program Files\Docker Toolbox\docker.exe: error during connect: Post https://192.168.99.100:2376/v1.40/containers/create: dial tcp 192.168.99.100:2376: connectex: No connection could be made because the target machine actively refused it. See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

Now I stop VPN to restart Docker Quickstart Terminal and run docker-machine ls again, the message as below:

NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default * virtualbox Running tcp://192.168.99.100:2376 v19.03.12

docker run hello-world will show as below:

Unable to find image 'hello-world:latest' locally C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: dial tcp: lookup my-proxy.co.jp on 10.0.2.3:53: no such host. See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

I want to know how to use Docker for my case: Only VPN and Proxy can coonect to Internet, no VPN even with Wi-Fi no Internet.