Cannot access web server created by Docker
When you specify -p 8086:8086
, you are telling docker that you want to take port 8086
from inside the container and publish it to port 8086
on your host machine. However, there is nothing at port 8086
in your container. Ngix is running on port 80
. The command you want to use is:
docker run -d -p 8086:80 --name webserver nginx
This will map port 80
in your container to 8086
on your host machine. You should now be able to send it HTTP requests at localhost:8086
from your host machine.
docker ps command is showing the port number as 80 and you are exporting port number 8086, why?
also try to use localhost:8086 from the browser.