I've tried to run this command
docker run -t -i -d --name demo -p 8080:80 ubuntu-apache2-img
Then I've looked for all my containers
docker ps -a
8fffa1a8da7b ubuntu-apache2-img "/bin/bash" 59 minutes ago Up 3 minutes 0.0.0.0:8080->80/tcp demo
Ho cercato l'IP del mio container
docker inspect 8fffa1a8da7b | grep '"IPAddr' | awk '{print $2}'
"172.17.0.45",
And If I try to open http://172.17.0.45:8080 from my host, i get "This site can’t be reached"
Why?
Are you using docker host ? If so, you might want to change the IP address (container IP) with your docker host IP address.