adamf77
(Adamf77)
April 19, 2021, 4:15pm
1
Hi There,
I’m new to Docker and am trying things out.
My first question is, i have a container running, which has an app running on port 9150
How do i “expose” this so its accessible via the internet ?
I can see its listening on 0.0.0.0:9150
My Host server is Centos7.
I have iptables installed, and have enable masquerading and the docker network is in the public zone.
There is no upstream firewall between the server and the Border gateway.
Any help appreciated !
A
terpz
(Martin Terp)
April 20, 2021, 8:48am
2
If you allready defined -p 9150:9150 (fx.) it should be exposed, and you should be able to access it
adamf77
(Adamf77)
April 20, 2021, 4:32pm
3
thanks for your reply!
i have these commands in my yaml file:
ports:
- 5601:5601
expose:
- “5601”
i see the ports in a netstat as listening, but cannot connect from a browser as this is a http server
terpz
(Martin Terp)
April 20, 2021, 4:50pm
4
If the image you’re using, is using port 9150, and you want to use port 5601, you need to define the compose section as:
ports:
- 5601:9150
the “expose:” part of your yaml is not needed.
Hope it makes sense else please include your compose file
adamf77
(Adamf77)
April 20, 2021, 4:54pm
5
sorry i got that bit wrong…
the container has a http server running on port 9150…
so i expect to go http://ip-address:9150 and the site shows
but it doesnt
thanks again for your responses
terpz
(Martin Terp)
April 20, 2021, 4:57pm
6
So you have:
ports:
- 9150:9150
?
again. please share your compose file make it a bit easier to help, ofcourse remove passwords first ^^
adamf77
(Adamf77)
April 20, 2021, 4:59pm
7
here you go…
its a test config for a demo of elastic search
the containers start just fine, i just cant access them !
docker-compose.yaml.txt (1.88 KB)
terpz
(Martin Terp)
April 20, 2021, 5:09pm
8
Sorry, but im a bit confused, where does port 9150 come from?
Its not listed on here either?
does port 5601 work?
adamf77
(Adamf77)
April 20, 2021, 5:16pm
9
9150 was an example port i was trying…
sorry i confused myself !
the web server is on port 5601 as you have deduced !
the port is listening…
tcp 0 0 0.0.0.0:5601 0.0.0.0:* LISTEN
but browsing to it does nothing.
i cannot telnet to it on port 5601 either…
terpz
(Martin Terp)
April 20, 2021, 6:49pm
10
Does “docker logs odfe-kibana” give anything?
adamf77
(Adamf77)
April 20, 2021, 6:52pm
11
hmmm
notably:
{“type”:“log”,"@timestamp ":“2021-04-19T15:45:17Z”,“tags”:[“listening”,“info”],“pid”:1,“message”:“Server running at http://0:5601 ”}
{“type”:“log”,"@timestamp ":“2021-04-19T15:45:17Z”,“tags”:[“info”,“http”,“server”,“Kibana”],“pid”:1,“message”:“http server running at http://0:5601 ”}
terpz
(Martin Terp)
April 20, 2021, 6:59pm
12
When you say you cant telnet/browser to that ip, is that from a different host?
what happends if you try and curl http://127.0.0.1:5601 from the server itself?
tech9to6
(Tech9to6)
May 5, 2021, 5:13pm
14
I was able to see all the images in docker desktop under images. But all of a sudden from yesterday, I can see images with docker images command from CLI, but could not see them on docker desktop.