Docker Community Forums

Share and learn in the Docker community.

Windows contianer : how to talk to other box in the same network with computer name


I am trying to set up a private network and have the 2 container join and talk to each other.

I am able to have them talk using ip adress. However i can’t get them to talk using hostname or computer name. Can anyone help?


do you use docker compose or you create each container independently?

Anyway, when using docker run to create containers independently I have no problem to establish communication between the both of them using name:

Start Containers:
docker run --rm --hostname server01 -it microsoft/windowsservercore powershell
docker run --rm --hostname server02 -it microsoft/windowsservercore powershell

And then you can try ping them across:

  • server01: ping server02
  • server02: ping server01

I have no problem to do that… In both cases I can see successful responses via IPv6. The same via Docker Compose:
version: '2.1’
image: microsoft/windowsservercore
hostname: s01
- s01
command: ping localhost -t
image: microsoft/windowsservercore
hostname: s02
- s02
command: ping localhost -t
- s01
name: nat


I give it a try but fail.


This is from WindowsServer 2016 but the same results I can see on my Windows 10 system.

I am watching again your screenshot and I can see one difference - you are using some external DNS - “”. I can see two things now…

  • You are hosting your server on Azure, isn`t it? Maybe there is something specific on Azure.
  • Isnt possible the containers are trying to find server name in an external DNS that of course doesnt know them (there is no - FQDN).

Sorry, I can`t help you more, I am neither an admin nor network specialist, just poor and programmer and I am using this forum because the product (Windows Containers) has so many missing features (compared with Docker on Linux - that is logical), issues and poor documentation (no excuse for that).

Thank you for your time.

I will continue the googling :sob:

Try to redefine your network interfaces, I hope this could help…

@star00docker I’m not sure your approach is the right now. Here’s what works for me:

docker run --name server1 --network=nat -d microsoft/windowsservercore powershell /c sleep 3600
docker run --network=nat -ti microsoft/windowsservercore powershell
<wait for prompt in container>
ping server1

Pinging server1 [] with 32 bytes of data:
Reply from bytes=32 time<1ms TTL=128
Reply from bytes=32 time<1ms TTL=128

There’s still some funkiness with DNS on Windows, see this workaround:

(I didn’t have to do that on my WS2016 system)