Problem scenario
You installed Docker (on either Ubuntu or RedHat, see the links if you actually need help with that). You do not want to create a Docker network on your server. How do you create a simple Docker container with Nginx without creating a user-defined network?
Solution
#1 Run these two commands:
docker pull nginx
docker run --name docker-nginx -p 80:80 nginx
# If the command hangs, use ctrl-c. In our experience, the Docker container is successfully created despite not gracefully returning to the command prompt as you would normally expect. Other people have experienced this problem.
# To read more about this problem of the "docker run" command hanging, you can see this link or this Docker website posting.
#2 Run two more commands:
docker ps -a
# Find the alphanumeric container ID in the results of the above command. Then substitute abcd1234 for that container ID in the following command:
docker start abcd1234
#Run the above command but with the Docker container ID.
#3 Now assuming outbound connections from your AWS instance are not blocked over port 80 (this depends on the configuration of the Security Group in AWS that governs your Linux server), you should be able to open a web browser and type in the external IP address of the Linux server. To find the external IP address from the back-end, run this command from the Linux server's command prompt: curl http://icanhazip.com
The result of that command can be used from a web UI to test Nginx in a Docker container.