An error occurred trying to connect after moving laptop from one network to another

How can I get Docker to continue working when my laptop switches from one network to another?

I’ve tried to provide as much detail below as possible, but please let me know if I should add any information.

Thanks in advance for any information you have that will help!

Symptoms:

  • Running “docker ps” gives the error, “An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.23/containers/json: open //./pipe/docker_engine: The system cannot f
    ind the file specified.”

  • Closing and restarting the Docker Quickstart Terminal displays the error, “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: i/o timeout. You can attempt to regenerate them using ‘docker-machine regenerate-certs [name]’. Be advised that this will trigger a Docker daemon restart which will stop running containers.”

Things I’ve tried:

  • Restarting Docker Quickstart Terminal (results above)

  • Running “docker-machine restart”, including “docker-machine env”

  • Opening VirtualBox and manually restarting the VM from there.

  • I’ve installed the latest version of everything, including Docker Toolbox, Oracle VirtualBox, etc…
    Docker version 1.11.2, installed via Windows Toolbox on Windows 7…

  • Creating a new Default container using “docker-machine create -d virtualbox --virtualbox-host-dns-resolver default”

  • Going into VirtualBox, turning off the default VM, starting Docker Quickstart Terminal, results:
    Start of results >>>
    Starting “default”…
    (default) Check network to re-create if needed…
    (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: i/o timeout
You can attempt to regenerate them using ‘docker-machine regenerate-certs [name]’.
Be advised that this will trigger a Docker daemon restart which will stop running containers.
<<< End of results

Things that work, but generally suck: