Curl to host and port not working from inside Docker container

Server Fault Asked by Bhanu Praveen G on July 26, 2020

Below are the containers:

CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS                                            NAMES
7ba94a1bd249        docker-elk_kibana          "/usr/local/bin/dumb…"   27 minutes ago      Up 27 minutes>5601/tcp                           docker-elk_kibana_1
267c7f8136a8        docker-elk_elasticsearch   "/tini -- /usr/local…"   27 minutes ago      Up 27 minutes>9200/tcp,>9300/tcp   elasticsearch

Ran curl from inside Container:

bash-4.2$ curl -v
* About to connect() to port 9200 (#0)
*   Trying
* No route to host
* Failed connect to; No route to host
* Closing connection 0
curl: (7) Failed connect to; No route to host

Ran same curl from host which is connecting fine:

[[email protected] docker-elk]# curl -v
* Rebuilt URL to:
*   Trying
* Connected to ( port 9200 (#0)
> GET / HTTP/1.1
> Host:
> User-Agent: curl/7.61.1
> Accept: */*
< HTTP/1.1 200 OK
< content-type: application/json; charset=UTF-8
< content-length: 541

Problem, is from inside docker container, not able to curl for connecting to host machine and port 9200.

[[email protected] docker-elk]# getenforce

[[email protected] docker-elk]# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.0 (Ootpa)"
PRETTY_NAME="Red Hat Enterprise Linux 8.0 (Ootpa)"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"

Firewall is disabled. and ping host is working inside Container. Kindly let me know what would be the issue in connecting to host and port from inside Container?

Add your own answers!

Related Questions

Any way to migrate AWS T3 x64 to T4G ARM?

1  Asked on November 27, 2020 by ruben-john


how to use the pool connection correctly?

0  Asked on November 25, 2020 by lucas-muoz


azure networking, azure mover failed

0  Asked on November 25, 2020 by frdric-guigui


Servicing ws:// in Node.js via Tomcat and Apache

1  Asked on November 23, 2020 by ken-y-n


change URI for tfs project

0  Asked on November 23, 2020 by akrem


Problem with symbolic links in FTP client

4  Asked on November 15, 2020 by falcata


Fibre channel multipath

0  Asked on November 11, 2020 by kab00m


NGINX Dynamic Port proxy_pass

2  Asked on November 8, 2020 by fyroc


Printer not reachable in network

2  Asked on November 4, 2020 by andrea


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir