By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
This topic provides an overview of the Docker CLI and its usage. docker --help.
docker --version
docker --help
docker run
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
docker run -it ubuntu /bin/bash
docker ps -a
docker stop <container_id>
docker rm -f <container_id>
docker rmi <image_id>
-it
ubuntu
/bin/bash
-a
docker rmi $(docker images -q -f dangling=true)
-q
-f dangling=true
docker: Error response from daemon: ...
sudo systemctl start docker
dockerd --log-driver=none
docker pull <image_name>
docker start <container_id>
Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2
docker ps
docker images
• docker --help shows the full list of available commands and flags.• docker version shows the Docker version.• docker info shows detailed information about the Docker environment.• docker system df shows disk space usage by Docker.• docker system prune removes unused data.• docker rmi -f $(docker images -q) deletes all unused images.• docker rm -f $(docker ps -aq) deletes all stopped containers.• docker stop $(docker ps -aq) stops all running containers.• docker logs -f <container_id> shows container logs.• docker exec -it <container_id> /bin/bash opens a new shell in a running container.• ⚠️ docker rm -f $(docker ps -aq) deletes all stopped containers, use with caution.
docker version
docker info
docker system df
docker system prune
docker rmi -f $(docker images -q)
docker rm -f $(docker ps -aq)
docker stop $(docker ps -aq)
docker logs -f <container_id>
docker exec -it <container_id> /bin/bash
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.