Docker Community Forums

Share and learn in the Docker community.

Placing a Windows container on local network

Hi! I have already asked this (but rewritten here) in the General Discussions section, but with no answer. So a collage recommended me to repost it here in Docker Desktop for Windows instead.


I am trying to put Windows container on the network instead of "localhost", in order to have multiple containers up with port 80 exposed. But whatever I do it is still only available from localhost and limited to one container (due to port 80, and 8080, being unavailable).

I have read that in Linux this is solved by using macvlan, but that it is unavailable in Windows.

SETTING
Below is my current composer, does anyone see what’s wrong?
docker-compose.yml

version: "2.4"
networks:
    public:
        driver: nat
        ipam:
            driver: windows
            config:
            - subnet: 192.168.10.0/24
services:
    publicsystem:
        build: ./PublicSystem
        networks:
            - public
        ports:
            - 80:80
            - 8080:8080

Why don’t you run these containers behind a proxy like traefik?

Because I didn’t know about it…? :smiley:
Thanks for the suggestion, I will look in to it!

Does Traefik work in a Windows container? I can only find Linux tutorials that give me errors.

Yes, there is a version in a windows container, tag is windowsservercore-1809. And you don’t have to use traefik, you can build a proxy with any other software that you feel comfortable with. The main point is to add a proxy in the front of the containers and not to publish them directly to the network.

I used this method on Ubuntu 18.04 and it worked fine. Basically, you set up another network on the Docker host which is bound to the local NIC and assign a subset of the IP address range to be assigned to individual containers. I haven’t used Docker on Windows so can’t say if it will work the same.

My understanding is that Windows Containers does not support Macvlan, though. :frowning:
EDIT: But I will read and try your suggestion anyway. Thanks!

Looks like you’re right - * The macvlan networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server. (from https://docs.docker.com/network/network-tutorial-macvlan/).
An option could be to run a Hyper-V or VMWare Linux VM and then run the Docker containers which you want to run with macvlan in the VM.