Unable to access container web server on localhost: 80

I can not access the web server of the container on localhost:80 , but I can access the web server on 127.0.0.1:80 .

What am I doing wrong?

I have a docker version 1.12.2-rc1-beta27 (build: 12496) installed on a Mac.

I started the container with the docker run -d -p 80:80 training/webapp python app.py .

The container has the following properties

 $docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES baaf4676e548 training/webapp "python app.py" 22 minutes ago Up 22 minutes 0.0.0.0:80->5000/tcp big_volhard 

My understanding was that I should be able to access the website with localhost:80 .

This does not work. I get an error

 Could not get any response 

I know that I am using Docker for Mac since I ran the env | grep DOCKER env | grep DOCKER and does not return a result.

First update: My /etc/hosts looks like this:

 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost 

Second update: I also noticed that when running containers using the docker run -d -P training/webapp python app.py , localhost:autoGeneratedPortNumber .

Now I'm not sure why both commands (which are more or less the same, only the difference in the same port number is indicated) have different effects.

+5
source share

Source: https://habr.com/ru/post/1258122/


All Articles