Just started working with Docker, but was under the impression that finding containers by name was working? I created 2 simple containers that just ping themselves infinitely. I then connect to one and try to ping itself and the other container by name, but only pinging by container id works.
Consider:
C:\docker --version Docker version 17.06.2-ce, build cec0b72 C:\docker create --name aaa --network-alias aaa microsoft/nanoserver ping -t localhost C:\docker create --name bbb --network-alias bbb microsoft/nanoserver ping -t localhost C:\docker start aaa bbb C:\docker ps CONTAINER ID IMAGE COMMAND NAMES 9c9a6f6735dc microsoft/nanoserver "ping -t localhost" bbb 1a32e94b9090 microsoft/nanoserver "ping -t localhost" aaa
Connect to ‘aaa’:
C:\docker exec -it aaa cmd Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:\>
Embedded DNS does not resolve via container name or network alias:
C:\>ping aaa Ping request could not find host aaa. Please check the name and try again. C:\>ping bbb Ping request could not find host bbb. Please check the name and try again.
Only via container id:
C:\>ping 1a32e94b9090 Pinging 1a32e94b9090 [fe80::1108:7bea:858f:69bc%4] with 32 bytes of data: Reply from fe80::1108:7bea:858f:69bc%4: time<1ms Reply from fe80::1108:7bea:858f:69bc%4: time<1ms Reply from fe80::1108:7bea:858f:69bc%4: time<1ms Reply from fe80::1108:7bea:858f:69bc%4: time<1ms Ping statistics for fe80::1108:7bea:858f:69bc%4: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms C:\>ping 9c9a6f6735dc Pinging 9c9a6f6735dc [fe80::c91b:1dbe:8f28:b5ae%4] with 32 bytes of data: Reply from fe80::c91b:1dbe:8f28:b5ae%4: time<1ms Reply from fe80::c91b:1dbe:8f28:b5ae%4: time<1ms Reply from fe80::c91b:1dbe:8f28:b5ae%4: time<1ms Reply from fe80::c91b:1dbe:8f28:b5ae%4: time<1ms Ping statistics for fe80::c91b:1dbe:8f28:b5ae%4: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms C:\>