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

Hi,

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?

Hello,

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’
services:
s01:
image: microsoft/windowsservercore
hostname: s01
networks:
default:
aliases:
- s01
command: ping localhost -t
s02:
image: microsoft/windowsservercore
hostname: s02
networks:
default:
aliases:
- s02
command: ping localhost -t
depends_on:
- s01
networks:
default:
external:
name: nat

Regards,
Jakub

I give it a try but fail.

:sob:

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 - “dtran.j2.internal.cloudapp.net”. 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 server01.dtran.j2.internal.cloudapp.net - 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
<id>
docker run --network=nat -ti microsoft/windowsservercore powershell
<wait for prompt in container>
ping server1

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

There’s still some funkiness with DNS on Windows, see this workaround: https://github.com/friism/MusicStore/blob/master/Dockerfile.windows#L6

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