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:

[root@pla11010 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.

[root@pla11010 docker-elk]# getenforce

[root@pla11010 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

Apache reverse proxy from root to context

1  Asked on December 13, 2021 by jzonthemtn


Barman: rsync wal archival stalls on some files

1  Asked on December 13, 2021 by thoro


Unable to port forward via ssh on windows

1  Asked on December 13, 2021 by justtryingnottofail


git clone does not work in (sshfs) mapped drive in windows

0  Asked on December 13, 2021 by dhanabal-m


OpenSSL – error in SSLv2/v3 read client hello A

1  Asked on December 13, 2021 by tuyen-nguyen


Prevent port change on redirect in nginx

5  Asked on December 11, 2021 by arbales


PHP-FPM does not automatically start after reboot

3  Asked on December 11, 2021 by steveedson


Postgres roles best practice implementation

1  Asked on December 11, 2021 by jp-beaudry


Rinetd failing to run

1  Asked on December 11, 2021 by opad


Nagios service check interval based on host type

2  Asked on December 11, 2021 by sebastien-prudhomme


Cannot connect to Linux Samba share from Windows 10

15  Asked on December 11, 2021 by pngl


Ask a Question

Get help from others!

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