title: Can't access Docker container on exposed port from anywhere even localhost
body: <p>I have been searching for an answer for this for days and don't know the best place to ask for help, I must be missing something simple.</p>
  <p>This problem is common to both my Fedora27 workstation and Ubuntu Server 16.04 LTS</p>
  <p>I have installed Docker successfully and have some containers working but others cannot be accessed on 0.0.0.0: or localIP:</p>
  <p>I have disabled firewall and flushed iptables, amongst others I am trying to get a minecraft server running on 25565, following this instruction:</p>
  <blockquote>
  <p>To simply use the latest stable version, run</p>
  <p><code>docker run -d -p 25565:25565 --name mc itzg/minecraft-server</code></p>
  <p>where the standard server
  port, 25565, will be exposed on your host machine.</p>
  </blockquote>
  <p>The container runs OK:</p>
  <pre><code>[benjbt@localhost ~]$ sudo docker ps
  CONTAINER ID  IMAGE                           COMMAND       CREATED        STATUS                  PORTS                                NAMES
  3240121d414e  itzg/minecraft-server:latest    &quot;/start&quot;      2 minutes ago  Up 2 minutes (healthy)  0.0.0.0:25565-&gt;25565/tcp, 25575/tcp  mc
  8f1cf88207e7  portainer/portainer             &quot;/portainer&quot;  9 minutes ago  Up 9 minutes            0.0.0.0:9000-&gt;9000/tcp               eager_northcutt
  </code></pre>
  <p>However, the port is not accessible:</p>
  <pre><code>can’t establish a connection to the server at 0.0.0.0:25565
  </code></pre>
  <p>Please help me understand what is blocking my port?</p>
  <pre><code>[benjbt@localhost ~]$ sudo iptables -L
  Chain INPUT (policy ACCEPT)
  target     prot opt source               destination         
  
  Chain FORWARD (policy ACCEPT)
  target     prot opt source               destination         
  DOCKER-ISOLATION  all  --  anywhere             anywhere            
  DOCKER     all  --  anywhere             anywhere            
  ACCEPT     all  --  anywhere             anywhere             ctstate 
  RELATED,ESTABLISHED
  ACCEPT     all  --  anywhere             anywhere            
  ACCEPT     all  --  anywhere             anywhere            
  
  Chain OUTPUT (policy ACCEPT)
  target     prot opt source               destination         
  
  Chain DOCKER (1 references)
  target     prot opt source               destination         
  ACCEPT     tcp  --  anywhere             172.17.0.2           tcp 
  dpt:cslistener
  ACCEPT     tcp  --  anywhere             172.17.0.3           tcp 
  dpt:25565
  
  Chain DOCKER-ISOLATION (1 references)
  target     prot opt source               destination         
  RETURN     all  --  anywhere             anywhere  
  </code></pre>
  <p>TROUBLESHOOTING: Answers from @BMitch comment</p>
  <ol>
  <li>The Container seems healthy</li>
  </ol>
  <pre><code>CONTAINER ID        IMAGE                         COMMAND             CREATED             STATUS              PORTS                                                NAMES
      6b5822a781c1        rlenferink/minecraft:latest   &quot;/start&quot;            38 hours ago        Up 38 hours         0.0.0.0:25565-&gt;25565/tcp, 0.0.0.0:25565-&gt;25565/udp   mc
      8f592bb99d8e        portainer/portainer           &quot;/portainer&quot;        8 days ago          Up 45 hours         0.0.0.0:9000-&gt;9000/tcp                               practical_goldwasser
  
      root@server:~# docker logs mc
      [08:55:19] [Server thread/INFO]: Starting minecraft server version 1.12.2
      [08:55:19] [Server thread/INFO]: Loading properties
      [08:55:19] [Server thread/INFO]: Default game type: SURVIVAL
      [08:55:19] [Server thread/INFO]: Generating keypair
      [08:55:19] [Server thread/INFO]: Starting Minecraft server on *:25565
      [08:55:19] [Server thread/INFO]: Using epoll channel type
      [08:55:19] [Server thread/INFO]: Preparing level &quot;world&quot;
      [08:55:20] [Server thread/INFO]: Loaded 488 advancements
      [08:55:20] [Server thread/INFO]: Preparing start region for level 0
      [08:55:21] [Server thread/INFO]: Preparing spawn area: 2%
      [08:55:22] [Server thread/INFO]: Preparing spawn area: 18%
      [08:55:23] [Server thread/INFO]: Preparing spawn area: 74%
      [08:55:23] [Server thread/INFO]: Done (3.947s)! For help, type &quot;help&quot; or     &quot;?&quot;
          root@server:~# docker container inspect mc
      [
          {
              &quot;Id&quot;: &quot;6b5822a781c147012e1aa279320ce1cb235193a11da2e8a640848ce252c56027&quot;,
              &quot;Created&quot;: &quot;2018-05-13T08:55:08.363756829Z&quot;,
              &quot;Path&quot;: &quot;/start&quot;,
              &quot;Args&quot;: [],
              &quot;State&quot;: {
                  &quot;Status&quot;: &quot;running&quot;,
                  &quot;Running&quot;: true,
                  &quot;Paused&quot;: false,
                  &quot;Restarting&quot;: false,
                  &quot;OOMKilled&quot;: false,
                  &quot;Dead&quot;: false,
                  &quot;Pid&quot;: 15719,
                  &quot;ExitCode&quot;: 0,
                  &quot;Error&quot;: &quot;&quot;,
                  &quot;StartedAt&quot;: &quot;2018-05-13T08:55:10.734864313Z&quot;,
                  &quot;FinishedAt&quot;: &quot;0001-01-01T00:00:00Z&quot;
              },
              &quot;Image&quot;: &quot;sha256:648452c4d7be732fc87d5bcb393e94cacd8a22fc7fbb3f98bfb655aaa9f0d400&quot;,
              &quot;ResolvConfPath&quot;: &quot;/var/lib/docker/containers/6b5822a781c147012e1aa279320ce1cb235193a11da2e8a640848ce252c56027/resolv.conf&quot;,
              &quot;HostnamePath&quot;: &quot;/var/lib/docker/containers/6b5822a781c147012e1aa279320ce1cb235193a11da2e8a640848ce252c56027/hostname&quot;,
              &quot;HostsPath&quot;: &quot;/var/lib/docker/containers/6b5822a781c147012e1aa279320ce1cb235193a11da2e8a640848ce252c56027/hosts&quot;,
              &quot;LogPath&quot;: &quot;/var/lib/docker/containers/6b5822a781c147012e1aa279320ce1cb235193a11da2e8a640848ce252c56027/6b5822a781c147012e1aa279320ce1cb235193a11da2e8a640848ce252c56027-json.log&quot;,
              &quot;Name&quot;: &quot;/mc&quot;,
              &quot;RestartCount&quot;: 0,
              &quot;Driver&quot;: &quot;overlay2&quot;,
              &quot;Platform&quot;: &quot;linux&quot;,
              &quot;MountLabel&quot;: &quot;&quot;,
              &quot;ProcessLabel&quot;: &quot;&quot;,
              &quot;AppArmorProfile&quot;: &quot;docker-default&quot;,
              &quot;ExecIDs&quot;: null,
              &quot;HostConfig&quot;: {
                  &quot;Binds&quot;: [
                      &quot;/mnt/minecraft:/data&quot;
                  ],
                  &quot;ContainerIDFile&quot;: &quot;&quot;,
                  &quot;LogConfig&quot;: {
                      &quot;Type&quot;: &quot;json-file&quot;,
                      &quot;Config&quot;: {}
                  },
                  &quot;NetworkMode&quot;: &quot;bridge&quot;,
                  &quot;PortBindings&quot;: {
                      &quot;25565/tcp&quot;: [
                          {
                              &quot;HostIp&quot;: &quot;&quot;,
                              &quot;HostPort&quot;: &quot;25565&quot;
                          }
                      ],
                      &quot;25565/udp&quot;: [
                          {
                              &quot;HostIp&quot;: &quot;&quot;,
                              &quot;HostPort&quot;: &quot;25565&quot;
                          }
                      ]
                  },
                  &quot;RestartPolicy&quot;: {
                      &quot;Name&quot;: &quot;no&quot;,
                      &quot;MaximumRetryCount&quot;: 0
                  },
                  &quot;AutoRemove&quot;: false,
                  &quot;VolumeDriver&quot;: &quot;&quot;,
                  &quot;VolumesFrom&quot;: null,
                  &quot;CapAdd&quot;: null,
                  &quot;CapDrop&quot;: null,
                  &quot;Dns&quot;: [],
                  &quot;DnsOptions&quot;: [],
                  &quot;DnsSearch&quot;: [],
                  &quot;ExtraHosts&quot;: null,
                  &quot;GroupAdd&quot;: null,
                  &quot;IpcMode&quot;: &quot;shareable&quot;,
                  &quot;Cgroup&quot;: &quot;&quot;,
                  &quot;Links&quot;: null,
                  &quot;OomScoreAdj&quot;: 0,
                  &quot;PidMode&quot;: &quot;&quot;,
                  &quot;Privileged&quot;: false,
                  &quot;PublishAllPorts&quot;: false,
                  &quot;ReadonlyRootfs&quot;: false,
                  &quot;SecurityOpt&quot;: null,
                  &quot;UTSMode&quot;: &quot;&quot;,
                  &quot;UsernsMode&quot;: &quot;&quot;,
                  &quot;ShmSize&quot;: 67108864,
                  &quot;Runtime&quot;: &quot;runc&quot;,
                  &quot;ConsoleSize&quot;: [
                      0,
                      0
                  ],
                  &quot;Isolation&quot;: &quot;&quot;,
                  &quot;CpuShares&quot;: 0,
                  &quot;Memory&quot;: 0,
                  &quot;NanoCpus&quot;: 0,
                  &quot;CgroupParent&quot;: &quot;&quot;,
                  &quot;BlkioWeight&quot;: 0,
                  &quot;BlkioWeightDevice&quot;: [],
                  &quot;BlkioDeviceReadBps&quot;: null,
                  &quot;BlkioDeviceWriteBps&quot;: null,
                  &quot;BlkioDeviceReadIOps&quot;: null,
                  &quot;BlkioDeviceWriteIOps&quot;: null,
                  &quot;CpuPeriod&quot;: 0,
                  &quot;CpuQuota&quot;: 0,
                  &quot;CpuRealtimePeriod&quot;: 0,
                  &quot;CpuRealtimeRuntime&quot;: 0,
                  &quot;CpusetCpus&quot;: &quot;&quot;,
                  &quot;CpusetMems&quot;: &quot;&quot;,
                  &quot;Devices&quot;: [],
                  &quot;DeviceCgroupRules&quot;: null,
                  &quot;DiskQuota&quot;: 0,
                  &quot;KernelMemory&quot;: 0,
                  &quot;MemoryReservation&quot;: 0,
                  &quot;MemorySwap&quot;: 0,
                  &quot;MemorySwappiness&quot;: null,
                  &quot;OomKillDisable&quot;: false,
                  &quot;PidsLimit&quot;: 0,
                  &quot;Ulimits&quot;: null,
                  &quot;CpuCount&quot;: 0,
                  &quot;CpuPercent&quot;: 0,
                  &quot;IOMaximumIOps&quot;: 0,
                  &quot;IOMaximumBandwidth&quot;: 0
              },
              &quot;GraphDriver&quot;: {
                  &quot;Data&quot;: {
                      &quot;LowerDir&quot;: &quot;/var/lib/docker/overlay2/4f5f630442b65a59c7f174a8aad1dc356cb6f565e76b2ca4afa49132afbaf30d-init/diff:/var/lib/docker/overlay2/a93b9c08d02aa86d8a53f5a32f166c8b40932f1430d4f9e3fd4e9c9e96af6557/diff:/var/lib/docker/overlay2/21b66b86842fd4c456df6ea2493edbabcd0df49f468100c9c2d7d2ef55711501/diff:/var/lib/docker/overlay2/e10484efe17398912f63644cff926875cd10fa8169d1ef2f1164d1000ccd7b06/diff:/var/lib/docker/overlay2/9b110a14a5fd9640fd95161c1fa35ec8cb98b4fb55a7caf70231b1b8ba238559/diff:/var/lib/docker/overlay2/a1cb33255806e73a1d7f9efd49c2bfcbb6edf190ed1976889cb10d3f81682c9f/diff:/var/lib/docker/overlay2/67286cfad81daababf3bac63ff9684c9567cd877e1e2ce4888d59257da4a06ca/diff:/var/lib/docker/overlay2/6904d0950327c52355e8b34b16d822b4eddf817de272f965f6fc6ad31089227d/diff:/var/lib/docker/overlay2/f6b782d3f37da3bf2c36ed70f6302d282ca4c80d39b3de3933b14902d149cfec/diff:/var/lib/docker/overlay2/e4eac39fc7fade8117216f45e9fe85bb42537714c19c02c70aab4ed62fad474e/diff:/var/lib/docker/overlay2/227df1848d1a3038188689c1f343ad42758bc6be9872ca8dda843a13b0bbf93e/diff&quot;,
                      &quot;MergedDir&quot;: &quot;/var/lib/docker/overlay2/4f5f630442b65a59c7f174a8aad1dc356cb6f565e76b2ca4afa49132afbaf30d/merged&quot;,
                      &quot;UpperDir&quot;: &quot;/var/lib/docker/overlay2/4f5f630442b65a59c7f174a8aad1dc356cb6f565e76b2ca4afa49132afbaf30d/diff&quot;,
                      &quot;WorkDir&quot;: &quot;/var/lib/docker/overlay2/4f5f630442b65a59c7f174a8aad1dc356cb6f565e76b2ca4afa49132afbaf30d/work&quot;
                  },
                  &quot;Name&quot;: &quot;overlay2&quot;
              },
              &quot;Mounts&quot;: [
                  {
                      &quot;Type&quot;: &quot;bind&quot;,
                      &quot;Source&quot;: &quot;/mnt/minecraft&quot;,
                      &quot;Destination&quot;: &quot;/data&quot;,
                      &quot;Mode&quot;: &quot;&quot;,
                      &quot;RW&quot;: true,
                      &quot;Propagation&quot;: &quot;rprivate&quot;
                  }
              ],
              &quot;Config&quot;: {
                  &quot;Hostname&quot;: &quot;34cb1418fb23&quot;,
                  &quot;Domainname&quot;: &quot;&quot;,
                  &quot;User&quot;: &quot;&quot;,
                  &quot;AttachStdin&quot;: false,
                  &quot;AttachStdout&quot;: false,
                  &quot;AttachStderr&quot;: false,
                  &quot;ExposedPorts&quot;: {
                      &quot;25565/tcp&quot;: {},
                      &quot;25565/udp&quot;: {}
                  },
                  &quot;Tty&quot;: false,
                  &quot;OpenStdin&quot;: false,
                  &quot;StdinOnce&quot;: false,
                  &quot;Env&quot;: [
                      &quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&quot;,
                      &quot;DEBIAN_FRONTEND=noninteractive&quot;
                  ],
                  &quot;Cmd&quot;: [
                      &quot;/start&quot;
                  ],
                  &quot;Image&quot;: &quot;rlenferink/minecraft:latest&quot;,
                  &quot;Volumes&quot;: {
                      &quot;/data&quot;: {}
                  },
                  &quot;WorkingDir&quot;: &quot;&quot;,
                  &quot;Entrypoint&quot;: null,
                  &quot;OnBuild&quot;: null,
                  &quot;Labels&quot;: {}
              },
              &quot;NetworkSettings&quot;: {
                  &quot;Bridge&quot;: &quot;&quot;,
                  &quot;SandboxID&quot;: &quot;e2c693daed0be5a204a83d408262a0fe01b66bdd99ddbb3a53229f5a58d5202c&quot;,
                  &quot;HairpinMode&quot;: false,
                  &quot;LinkLocalIPv6Address&quot;: &quot;&quot;,
                  &quot;LinkLocalIPv6PrefixLen&quot;: 0,
                  &quot;Ports&quot;: {
                      &quot;25565/tcp&quot;: [
                          {
                              &quot;HostIp&quot;: &quot;0.0.0.0&quot;,
                              &quot;HostPort&quot;: &quot;25565&quot;
                          }
                      ],
                      &quot;25565/udp&quot;: [
                          {
                              &quot;HostIp&quot;: &quot;0.0.0.0&quot;,
                              &quot;HostPort&quot;: &quot;25565&quot;
                          }
                      ]
                  },
                  &quot;SandboxKey&quot;: &quot;/var/run/docker/netns/e2c693daed0b&quot;,
                  &quot;SecondaryIPAddresses&quot;: null,
                  &quot;SecondaryIPv6Addresses&quot;: null,
                  &quot;EndpointID&quot;: &quot;819a8255b8ed4d79366a6d6ff4442a441f61d89bdfacc0c193ed2f9340024696&quot;,
                  &quot;Gateway&quot;: &quot;172.17.0.1&quot;,
                  &quot;GlobalIPv6Address&quot;: &quot;&quot;,
                  &quot;GlobalIPv6PrefixLen&quot;: 0,
                  &quot;IPAddress&quot;: &quot;172.17.0.3&quot;,
                  &quot;IPPrefixLen&quot;: 16,
                  &quot;IPv6Gateway&quot;: &quot;&quot;,
                  &quot;MacAddress&quot;: &quot;02:42:ac:11:00:03&quot;,
                  &quot;Networks&quot;: {
                      &quot;bridge&quot;: {
                          &quot;IPAMConfig&quot;: {},
                          &quot;Links&quot;: null,
                          &quot;Aliases&quot;: null,
                          &quot;NetworkID&quot;: &quot;e2ff1284a59794e19dd4dc39b17713ad11e0db3e698735014579405355f516ec&quot;,
                          &quot;EndpointID&quot;: &quot;819a8255b8ed4d79366a6d6ff4442a441f61d89bdfacc0c193ed2f9340024696&quot;,
                          &quot;Gateway&quot;: &quot;172.17.0.1&quot;,
                          &quot;IPAddress&quot;: &quot;172.17.0.3&quot;,
                          &quot;IPPrefixLen&quot;: 16,
                          &quot;IPv6Gateway&quot;: &quot;&quot;,
                          &quot;GlobalIPv6Address&quot;: &quot;&quot;,
                          &quot;GlobalIPv6PrefixLen&quot;: 0,
                          &quot;MacAddress&quot;: &quot;02:42:ac:11:00:03&quot;,
                          &quot;DriverOpts&quot;: null
                      }
                  }
              }
          }
      ]
  </code></pre>
  <ol start="2">
  <li>Netshoot</li>
  </ol>
  <pre><code>    Active Internet connections (only servers)
      Proto Recv-Q Send-Q Local Address           Foreign Address         State       
      tcp        0      0 :::25565                :::*                    LISTEN      
  </code></pre>
  <ol start="3">
  <li></li>
  </ol>
  <pre><code>    root@server:~# echo $DOCKER_HOST
      
      root@server:~# 
  </code></pre>
  <ol start="4">
  <li>On local machine</li>
  </ol>
  <pre><code>    $ curl http://127.0.0.1:25565
      curl: (52) Empty reply from server
  </code></pre>
  <ol start="5">
  <li>Local machine on firefox</li>
  </ol>
  <pre><code>    Problem loading page on...
      0.0.0.0:25565
      127.0.0.1:25565
      localhost:25565
      192.168.15.22:25565
  </code></pre>