I have set a Nginx to listen on a port 8080 in files/etc/nginx/conf.d/default.conf by adding listen 8080; to the only one server block I have.
I run Nginx by docker run with -p 8080:8080
I would like to ask why there is 80/tcp under PORTS of docker ps command as below?
STATUS NAMES IMAGE PORTS
Up 6 minutes docker-nginx docker-nginx:1.17.8 80/tcp, 0.0.0.0:8080->8080/tcp
command docker inspect docker-nginx shows:
"HostConfig": {
"PortBindings": {
"8080/tcp": [
{
"HostIp": "",
"HostPort": "8080"
}
"Config": {
"ExposedPorts": {
"80/tcp": {},
"8080/tcp": {}
},
"NetworkSettings": {
(...)
"Ports": {
"80/tcp": null,
"8080/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8080"
}
]
},
My intention is to have Nginx listen only to 8080 and not be accessible under any other port even by other containers belonging to the same network as Nginx. How to make Nginx not exposing the 80/tcp port?
I'm using a build that is FROM an official nginx:1.17.8 image.