docker run -d --name web -p 8080:80 nginx:alpine # run in the background, publish a port
docker ps # running containers (docker ps -a for all)
docker logs -f web # follow logs
docker exec -it web sh # shell inside the container
docker stop web && docker rm web
docker images; docker pull nginx:alpine; docker rmi nginx:alpine
docker inspect web # full JSON details
docker stats --no-stream
docker system df # space used
docker system prune # remove stopped containers, unused networks, dangling images (asks first)
Data written inside a container disappears when it is removed; keep data in volumes or bind mounts. -p 8080:80 maps host port 8080 to container port 80.