Docker Community Forums

Share and learn in the Docker community.

Query on docker port binding while deploying a website


(Pavanadepu) #1

I have created a container from training/webapp image using the below command:
sudo docker run -d -p 5000:5000 training/webapp python app.py

I am able to access my “Hello World” website.

When I try to change the ports using the below command, the container created but the website is not accessible(I have already removed the old container).
sudo docker run -d -p 5001:5001 training/webapp python app.py

It seems, still the website is trying to listen on port 5000 only. And as there is no active container mapped to 5000, the access is enied.

Can someone help me in resolving this issue.


(Gaurang Vyas) #2

check network stats by

netstat -ltn

command on your docker host. Check for new port #.