Why you could want to run nginx in docker
The one of the main docker advantage is total idempotency. Docker image is "thing in itself", you can copy or move it to other server and image's behavior will be the same.
Docker setup
Before run any "containerized" software, you should install docker itself. Let's to it:
Create the directory for the project files:
Put the content into this directory. I will just create one page for demo-purposes:
Start the service:
Server should give you correct answer if you open its IP via web:
It is enough for minimal configuration, but you could "attach" additional config-files to the web-server if needed. Also I advice you run container with -d flag, this flag will "say" docker to run the container into background so you can close terminal session:
Conclusion
In this matherial I said some advantages of containerized nginx running and described way to run it on Ubuntu 20.04.