Your First Docker Container
docker --version
docker run hello-world
docker run downloads the hello-world image from Docker Hub (a public registry of images) if you don't already have it, then starts a container from it.
Essential commands
docker pull nginx # download an image without running it
docker images # list images you have locally
docker run -d -p 8080:80 nginx # run nginx in the background, map port 8080 -> 80
docker ps # list running containers
docker ps -a # list all containers, including stopped ones
docker stop <container_id> # stop a running container
docker rm <container_id> # remove a stopped container
-p 8080:80 maps port 8080 on your machine to port 80 inside the container, that's how you reach a containerized web server from your browser.
TIP
docker ps only shows running containers, add -a to see stopped ones too, a common source of confusion for beginners.