Why can't I ping docker container?


Don't mark it as duplicate, because I looked at the other answers and it doesn't solve my problem.

I am using Windows 7 and docker toolbox.

I am doing this tutorial: <a href="https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/microservices" rel="nofollow">https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/microservices</a>

So after this command:

docker run -d -p 80:5000 --name hello-docker weather-microservice

I am not able to reach <a href="http://localhost/" rel="nofollow">http://localhost/</a>

So to troubleshoot it, I decided to ping the box. But I can't.

$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 78179117b516 weather-microservice "dotnet out/Weathe..." 18 hours ago Up 18 hours>5000/tcp hello-docker

The following doesn't work:

$ docker-machine ip weather-microservice Host does not exist: "weather-microservice" $ docker-machine ip hello-docker Host does not exist: "hello-docker" $ docker-machine ip 78179117b516 Host does not exist: "78179117b516" $ docker inspect 78179117b516 [ { "Id": "78179117b516332c61e393a36cc10f33e0f0b0d2f418d8483b79f90207e0de3c", "Created": "2017-06-27T23:37:12.147696044Z", "Path": "dotnet", "Args": [ "out/WeatherMicroservice.dll", "--server.urls", "" ], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 22059, "ExitCode": 0, "Error": "", "StartedAt": "2017-06-27T23:37:12.339014063Z", "FinishedAt": "0001-01-01T00:00:00Z" }, "Image": "sha256:0f6481b4a6fb864ecddb36c48a9facfbe30801d328daf59926e1c6c642f3ae24", "ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/78179117b516332c61e393a36cc10f33e0f0b0d2f418d8483b79f90207e0de3c/resolv.conf", "HostnamePath": "/mnt/sda1/var/lib/docker/containers/78179117b516332c61e393a36cc10f33e0f0b0d2f418d8483b79f90207e0de3c/hostname", "HostsPath": "/mnt/sda1/var/lib/docker/containers/78179117b516332c61e393a36cc10f33e0f0b0d2f418d8483b79f90207e0de3c/hosts", "LogPath": "/mnt/sda1/var/lib/docker/containers/78179117b516332c61e393a36cc10f33e0f0b0d2f418d8483b79f90207e0de3c/78179117b516332c61e393a36cc10f33e0f0b0d2f418d8483b79f90207e0de3c-json.log", "Name": "/hello-docker", "RestartCount": 0, "Driver": "aufs", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": null, "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "default", "PortBindings": { "5000/tcp": [ { "HostIp": "", "HostPort": "80" } ] }, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "ConsoleSize": [ 25, 80 ], "Isolation": "", "CpuShares": 0, "Memory": 0, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": null, "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DeviceCgroupRules": null, "DiskQuota": 0, "KernelMemory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": -1, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0 }, "GraphDriver": { "Data": null, "Name": "aufs" }, "Mounts": [], "Config": { "Hostname": "78179117b516", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "5000/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "DOTNET_SDK_VERSION=1.0.0-rc4-004771", "DOTNET_SDK_DOWNLOAD_URL=https://dotnetcli.blob.core.windows.net/dotnet/Sdk/1.0.0-rc4-004771/dotnet-dev-debian-x64.1.0.0-rc4-004771.tar.gz", "NUGET_XMLDOC_MODE=skip" ], "Cmd": null, "ArgsEscaped": true, "Image": "weather-microservice", "Volumes": null, "WorkingDir": "/app", "Entrypoint": [ "dotnet", "out/WeatherMicroservice.dll", "--server.urls", "" ], "OnBuild": null, "Labels": {} }, "NetworkSettings": { "Bridge": "", "SandboxID": "f1b934a02a8ac2e83bf68485d2dfb138b859d1e7b3beb4cb7ba966c9e3f4befa", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "5000/tcp": [ { "HostIp": "", "HostPort": "80" } ] }, "SandboxKey": "/var/run/docker/netns/f1b934a02a8a", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "9c555071437b1919db7c539f0bd3946b7a32f92dcf49c684dbbe01e0592b9af5", "Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "02:42:ac:11:00:02", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "6226280f22a5aaaa50c60d6f1a19ae8f7243bb79634c4394f62b21a10a868e48", "EndpointID": "9c555071437b1919db7c539f0bd3946b7a32f92dcf49c684dbbe01e0592b9af5", "Gateway": "", "IPAddress": "", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:02" } } } } ]

So when I do this:

$ ping Pinging with 32 bytes of data: Request timed out.

This works:

$ docker exec -it 78179117b516 ping www.google.com PING www.google.com ( 56 data bytes 64 bytes from icmp_seq=0 ttl=53 time=5.412 ms

What am I doing wrong or what am I missing?


It's because, the ip address you see via docker inspect command, is used by docker for internal networking and communication. It's not accessible from outside. Also, localhost won't work, since you are running docker toolbox, which runs inside ubuntu VM. You have to get the ip address of the VM first by,

docker-machine ls

If my memory serves right and toolbox works the same in Mac and Windows works, the ip address should be So, you will be able to reach your app via, <a href="" rel="nofollow noreferrer"></a>. Besides all these, why are you still using docker tool box. The new way is docker for mac/ docker for windows. It's way much easier and efficient. For start, you will be able to reach your app via localhost, without needing to know the ip address.


Actually, I got the IP of my container from Control Panel\Network and Internet\Network Connections. There was an adapter called vEthernet(DockerNAT) and it was the container's adapter. I could ping the IP I found for this adapter.


9 out of 10 times, it's windows firewall.

disable Windows Firewall entirely - turn it off - and see if you can get to your site.


  • Is it possible to mount a docker image and then access it (RO) as a normal directory or mounted devi
  • Google Managed VM error - custom entry point
  • Docker slow non-local database access
  • Can several nodes access mounted docker containers
  • sha256 of locally built docker image
  • How to continue to fill the data in next page by selenium?
  • Zend\\ServiceManager\\ServiceManager::get was unable to fetch or create an instance for getAlbum
  • There is any way to trigger a legacy mode for RDTSC?
  • R connection to postgresql requiring SSL
  • Get result sql from Prepared Statement by Oracle
  • UnrecognizedPropertyException while reading a yaml file
  • CakePHP 3 defaultConnectionName in plugin model doesn't work
  • JavaFX apllication does not run with Selenium WebDriver
  • Liquibase 3.3.3 refusing to run “due to maven configuration”
  • symfony2.6 doctrine2 schema_filter parameter not exists
  • Error in opening an Access database in python
  • How to access Environment Variable from AWS in my spring boot application
  • hibernate.properties does not found in maven project using hibernate
  • UWP : Print with out Printer Popup Dialoag
  • Selenium - How to skip the record from the Set after the its first occurrence
  • Maven use Encrypted passwords in POM
  • Trouble connecting to Google Cloud SQL server from deployed app
  • How do I include screenshots of the full page in my serenity report (and not only of the viewport) u
  • How to configure a timeout for an SQL query in Groovy?
  • Time taken for Hadoop job to execute
  • Cassandra 2.1: Recursion by nesting UDT's
  • Spark (Scala) Writing (and reading) to local file system from driver
  • pip in virtualenv gets ConnectTimeoutError
  • pyodbc doesn't report sql server error
  • chrome.tabs.executeScript only fires when the Developer Console is open
  • Play WS (2.2.1): post/put large request
  • Different response to non-authenticated users and AJAX calls
  • Perl system calls when running as another user using sudo
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Upload files with Ajax and Jquery
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • AngularJs get employee from factory
  • Proper way to use connect-multiparty with express.js?
  • Is it possible to post an object from jquery to bottle.py?