Docker Community Forums

Share and learn in the Docker community.

Fowarding ports problem


#1

Hey guys
New here with some problems.
Basically im running a webserver in the container at port 5000.
When creating the image i exposed port 5000
when running i use the flag -p 5001:5000
so i should be fowarding my port 5001 to the container port 5000 but i still cant access the
webserver running in port 5000.
Some one knows what’s the problem? is it internal fowarding in the container needed ?


(Victorbarajas89) #2

Hello, by default a web server listens to requests on port 80, for example when you create a web server even if you expose port 5000 on the dockerfile the service will continue listening on port 80, unless the server has been configured to change its port from 80 to 5000, only in this example does it work to expose port 5000 in the dockerfile.