I wrote a Dockerfile according to the tutorial on massive open online course
And edited the index.html file under the current directory
docker build -t ian/hello-nginx .
docker run -d -p 80:80 ian/hello-nginx
After that, my container id is given, but after accessing the server, what is the reason for refusing to connect?
Use Dockers PS-A to look at the containers that have been hung up, and then docker logs <container > to look at the logs of the containers.
Last but not least, it is wrong for you to write the Dockerfile in this way, which is not in line with the official best practices. It is suggested to look at the official best practices and then reconstruct your Dockerfile. What you have written in this configuration is almost obsessive-compulsive.