Address windows container by name in user-defined nat

Hello,

I am trying to figure out how to address one container from another by name instead of IP using user-defined network and without linking.
I am running docker host on Windows 10 (version 1607) and the Docker is running in Beta mode (Version 1.13.1-beta42 (10069)).
A user-defined nat network was created, so the current networks are: nat and prototype_net where nat configuration:

       "Name": "nat",
       "Id": "c37758225fa2b4f145366da416ed55a56c848404a10ca18760e911a7390f2cfa",
       "Scope": "local",
       "Driver": "nat",
       "EnableIPv6": false,
       "IPAM": {
           "Driver": "windows",
           "Options": null,
           "Config": [
               {
                   "Subnet": "172.25.128.0/20",
                   "Gateway": "172.25.128.1"
               }
           ]
       },
       "Internal": false,
       "Attachable": false,
       "Containers": {},
       "Options": {
           "com.docker.network.windowsshim.hnsid": "8b526022-ca4a-47a0-985f-6757d6259cde",
           "com.docker.network.windowsshim.networkname": "nat"
       },
       "Labels": {}

and the prototype_net network settings are:

   {
       "Name": "prototype_net",
       "Id": "10994e7c0d35e74529f7b0eab2d28a249d120f20f26d9fac1a08898db8ccf61f",
       "Scope": "local",
       "Driver": "nat",
       "EnableIPv6": false,
       "IPAM": {
           "Driver": "windows",
           "Options": {},
           "Config": [
               {
                   "Subnet": "172.25.132.0/24",
                   "Gateway": "172.25.132.1"
               }
           ]
       },
       "Internal": false,
       "Attachable": false,
       "Containers": {
           "604851979dbfb5202db4363edb9b22ba8e163830db044a5375c09cec9328245f": {
               "Name": "minio",
               "EndpointID": "709da4317fe60ebf8cbf7a132da60fc931991845ba2452cf739084f3ea0c4124",
               "MacAddress": "00:15:5d:54:c5:c9",
               "IPv4Address": "172.25.132.167/16",
               "IPv6Address": ""
           },
           "6966b34f125db81a3665b6d22699d96899bf7df4ba464561bfae78223a38f56a": {
               "Name": "viewer",
               "EndpointID": "ee38bba754084c2338cf06ca23e2958a6f7854eaf32d85d9bd1a8db852ca845c",
               "MacAddress": "00:15:5d:54:c2:2d",
               "IPv4Address": "172.25.132.46/16",
               "IPv6Address": ""
           }
       },
       "Options": {
           "com.docker.network.windowsshim.hnsid": "40e426c1-b074-400a-b063-8cfbb6937a3e",
           "com.docker.network.windowsshim.networkname": "prototype1_net"
       },
       "Labels": {}
   }

The prototype_net has two containers attached to it: viewer and minio. However, when I ping minio from viewer or vise versa I fail.
I started both containers with --network-alias argument to be the same as --name argument.

Hi, Did you find any solution to this !!
I am also trying to connect another windows container from different container with name and it does not work.

Hi,
I found the solution, but I still had couple of times when it did not work either, and some docker “warm up” was required.
Running Windows containers on Docker for Windows (same for Docker on Windows Server) you need to define a container name with docker run command. When working with Docker Compose it happens automatically. With docker run command it is important (for unknown reason) to use the name parameter in the format docker run --name=<container_name>. When you use it as docker run --name <container_name> which is valid syntax too, things do not work.After you did it, you can ping the container by <container_name> from another container given both of them are in the same network. I did not check if one sees another in another network. Mind that Windows containers do not require defining a user network to use this feature in opposite to Linux containers (your host is still running Windows) which follow the documentation and require a user network in order to address one another by name.

Hope this helps