If you ever needed a quick list of Docker commands, here you go..
1. Check that Docker is installed
docker --version
Shows the installed Docker version.
2. Run your first container
docker run hello-world
Pulls the official test image (if needed) and runs it. You should see a “Hello from Docker!” message.
3. See running containers
docker ps
Lists containers that are currently running.
Use docker ps -a to also show stopped ones.
4. See downloaded images
docker images
Shows every image on your machine (name, tag, size, ID).
5. Stop a running container
docker stop CONTAINER_ID
Gracefully stops a container. Get the ID from docker ps.
6. Remove a stopped container
docker rm CONTAINER_ID
Deletes a container that is already stopped.
7. Force stop and remove
docker rm -f CONTAINER_ID
Force-stops the container (if it’s still running) and removes it in one step.
Top comments (0)