BeginnerLesson 4 of 26
Everyday CLI commands
The handful of commands you will use every day.
bash
docker run -d --name web -p 8080:80 nginx # start in the background
docker ps # running containers (-a for all)
docker logs -f web # follow the output
docker exec -it web sh # open a shell inside
docker stop web && docker rm web # stop, then remove
docker system prune # clean up unused data-ddetaches,--namegives a friendly name.docker execruns an extra command in a running container.- Remove stopped containers regularly; they accumulate.