Docker cheatsheet
Package an app with everything it needs and run it anywhere
How it works
- Pull an image — Download a ready-made package from a registry.
- Run a container — The image becomes a running, isolated app.
- Map ports — Choose which port on your computer reaches the app.
- Throw it away — Delete the container; the image stays for next time.
First steps
docker run hello-world- Check that Docker works
docker ps -a- List containers
docker run -p 127.0.0.1:8080:80 nginx- Run a web server only on your own computer
docker stop <id>- Stop a container
docker image ls- List images