dockerhyper-v

How do I access a Docker container running in a Hyper-V VM from an external machine?


For $REASONS, I am trying to spin up a Docker image in a Hyper-V VM that is part of a failover cluster. In pictures, that looks like this (each component will be labeled with a name that I will hereafter use to describe that component):

------------------------------------------
| Physical failover cluster              |
| (hypervisor)                           |
|  ------------------------------------  |
|  | Hyper-V VM with Docker installed |  |
|  | (docker-host)                    |  |
|  |  --------------------            |  |
|  |  | Docker container |            |  |
|  |  | (container)      |            |  |
|  |  |                  |            |  |
|  |  --------------------            |  |
|  |                                  |  |
|  ------------------------------------  |
|                                        |
------------------------------------------

(Yes, I know this is a dumb idea; no, that is not the question. The question is whether I can make the dumb idea show some semblance of working like I want it to.)

I've got docker-container running properly on docker-host, and if I fire up a web browser on docker-host, I can access the server running in docker-container. However, I cannot access the Docker server from any other machine.

I have tried the following:

If necessary, I may be able to move the Docker container run on hypervisor instead of docker-host. However, I'd like to know if I can salvage what I've got so far.


Solution

  • I've got it working now. It turns out you have to open Windows Firewall settings and allow C:\Program Files\Docker\Docker\resources\com.docker.backend.exe through the firewall. After that, plus a little nginx-proxy-manager magic to handle URL proxying properly, it all works great!

    Thanks to @NickODell for pointing out the firewall as a culprit!