How to connect to a docker server on the network set-up with Hyper-V

Basically my question is: How do I connect to a docker host on the network?


  • Unable to build docker image with error “shim error: docker-runc not installed on system”
  • How to publish/push Dockerfile?
  • Docker: mounting volumes from other docker service (not container)
  • Docker to store an application(service) logs in a folder and purge them on a timely basis
  • Auto dockers containers by subdomain
  • Docker swarm and service discovery
  • We have a Windows Server 2012 machine that I would like to run a docker engine from.

    I’ve managed to get it running with docker-machine and the hyperv driver. I’ve also successfully gotten a docker host to work on my computer locally using VirtualBox, and have been using it.

    To ease access to docker for other people on the network on a perpetual set-up, I’d like to use the docker host instance on the server with Hyper-V.

    In my search for answers, I’ve not been able to find any mention of provisioning hosts on the network, only on the local and cloud.

    I’d like to know what commands do I have to use to connect my local docker-machine to the server’s docker host, and use it as the active docker host?

  • Does docker image hide my source code?
  • docker build step plugin inside jenkins docker container
  • Docker - Build rpi image on Mac
  • buddy-http-api response Unauthorized
  • Implement on-demand docker container start-up
  • ENTRYPOINT in Combination with CMD
  • One Solution collect form web for “How to connect to a docker server on the network set-up with Hyper-V”

    There’s a blog post explaining how to add a docker engine with an IP with the generic driver, as well as some extra steps you need to go through.


    SSH Keys

    The bottom section on certs explains how to get working on the remote docker engine after connecting with the create command

    Old answer

    To create/connect successfully the local machine must be able to ssh into the remote docker engine, and not just the server hosting the docker engine. This means a public key was generated and added (using puttygen or ssh-keygen) on the local machine and the OpenSSH RSA public key was added to the list of authorized keys in ~/.ssh/authorized_keys on the remote docker engine.

    An example of an OpenSSH RSA public key (because I get confused by these formats):

    ssh-rsa AAAAB3NzaC1kc3MAAACBAJ3hB5SAF6mBXPlZlRoJEZi0KSIN+NU2iGiaXZXi9CDrgVxTp6/sc56UcYCp4qjfrZ2G3+6PWbxYso4P4YyUC+61RU5KPy4EcTJske3O+aNvec/20cW7PT3TvH1+sxwGrymD50kTiXDgo5nXdqFvibgM61WW2DGTKlEUsZys0njRAAAAFQDs7ukaTGJlZdeznwFUAttTH9LrwwAAAIAMm4sLCdvvBx9WPkvWDX0OIXSteCYckiQxesOfPvz26FfYxuTG/2dljDlalC+kYG05C1NEcmZWSNESGBGfccSYSfI3Y5ahSVUhOC2LMO3JNjVyYUnOM/iyhzrnRfQoWO9GFMaugq0jBMlhZA4UO26yJqJ+BtXIyItaEEJdc/ghIwAAAIBFeCZynstlbBjP648+mDKIvzNSS+JYr5klGxS3q8A56NPcYhDMxGn7h1DKbb2AV4pO6y+6hDrWo3UT4dLVuzK01trwpPYp6JXTSZZ12ZaXNPz7sX9/z6pzMqhX4UEfjVsLcuF+ZS6aQCPO0ZZEa1z+EEIZSD/ykLQsDwPxGjPBqw= rsa-key-20160224

    Not having this key in the remote docker engine gave me a exit status 255 when I attempted to docker ssh into it. At this point, only regular ssh docker@ worked. Be prepared to repeat the above process.

    The article also mentions sudo, but the boot2docker image used by the Hyper-V driver already allows password-less sudo so that part is already done.


    Make sure TCP port 2376 is allowed connection to the remote docker engine, through the server’s firewall rules, physical firewall etc.

    The Command to Run

    Then this command connects the remote engine to docker-machine:

    > docker-machine create --driver generic --generic-ip-address --generic-ssh-user %USERNAME% vm
    > docker-machine ls
    NAME             ACTIVE      DRIVER       STATE     URL                         SWARM                   DOCKER   ERRORS
    default          -           virtualbox   Running   tcp://                           v1.10.1
    vm               -           generic      Running   tcp://                            Unknown

    vm is the newly added docker engine from the network, and is the IP of the docker engine on the server.


    If this works, just copying over the certs (ca.pem, ca-key.pem, cert.pem, key.pem) from the remote server directory %USERPROFILE%\.docker\machine\machines\<server's local docker engine name> to the same location on the local machine should keep it connected. Do not use docker-machine regenerate-certs since this disables any connections that other computers might have to that docker engine, including the server itself.


    Then finally making the engine active completes the connection.

    > IF /F "tokens=*" %G ('docker-machine env vm') do %G

    Note: This issue points out that the command docker-machine create --driver none --url=tcp:// <name> should add a remote machine’s docker engine as well, should the “none” driver be working in a future version.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.