Docker Community Forums

Share and learn in the Docker community.

Docker for Windows - expose linux container on network


(Ldoppea) #1

Hi,

I’m new to docker, so i’m sorry if this is the wrong place or I misunderstood docker concept.

I installed Docker for windows on win10 and Hyper-v is on, so if i’m correct i’m not using the toolbox/virtual-box.

I succeeded to download/create some linux container, to start them, to map their post and to access them from my host computer.

Now, I would like to access them from another computer on my local network (192.168.x.x). I want to do this for fast testing and proof of concept from my windows laptop, but I don’t expect to do this in production.

For my tests I used gitlab container like described here : https://docs.gitlab.com/omnibus/docker/
Here is one of the command I tried to run, but this one does not work due to the --network host option.

    docker run --detach ^
    --hostname gitlab.example.com ^
    --network host ^
    --publish 443:443 --publish 80:80 --publish 22:22 ^
    --name gitlab ^
    --restart always ^
    --volume /mnt/e/docker/gitlab/config:/etc/gitlab ^
    --volume /mnt/e/docker/gitlab/logs:/var/log/gitlab ^
    --volume /mnt/e/docker/gitlab/data:/var/opt/gitlab ^
    gitlab/gitlab-ce:latest

After failing at this, I found some resources on forums :

  • Some of them redirect to microsoft official doc. But when I try those option, docker does not find specified interfaces. I’m wondering if this documentation may be only for windows container, isn’t it?

  • Some of them just say that “Docker for Windows” cannot handle this scenario and that we should run docker from a virtual-box machine to make it possible. Those posts are generally from more than 1year so I don’t know if they are still accurate.

  • The only option that seems to be recognised is --network host but then my container is not accessible at all from the network nor my host.

What is the actual state? Is it possible to expose a linux container on the network using Docker for Windows?

Thanks