Docker Commands for Daily Use
A brief, junior-friendly guide to the Docker commands you will use most often in local development.
Introduction
This quick guide covers the Docker commands you will run most days while developing apps.
1. Check Docker status and version
Use these first when something feels off.
docker --version
docker info2. Work with images
Build, list, and remove images.
# Build an image from Dockerfile in current folder
docker build -t my-app:dev .
# List local images
docker images
# Remove an image
docker rmi my-app:dev3. Run and manage containers
Start, inspect, stop, and remove containers.
# Run a container in background
docker run -d --name my-app -p 3000:3000 my-app:dev
# List running containers
docker ps
# List all containers (including stopped)
docker ps -a
# Stop and remove a container
docker stop my-app
docker rm my-app4. Read logs and open a shell
Very useful for debugging.
# View logs
docker logs my-app
# Follow logs live
docker logs -f my-app
# Open a shell inside container
docker exec -it my-app sh5. Copy files in or out
Helpful for quick checks and backups.
# Copy file from host to container
docker cp ./local.txt my-app:/tmp/local.txt
# Copy file from container to host
docker cp my-app:/tmp/local.txt ./copied.txt6. Clean up unused resources
Use carefully to free disk space.
# Remove stopped containers
docker container prune
# Remove dangling images
docker image prune
# Remove unused containers, networks, and images
docker system prune7. Daily Docker Compose commands
If your project uses docker-compose.yml.
# Start services in background
docker compose up -d
# Rebuild and start services
docker compose up -d --build
# View service status
docker compose ps
# View logs
docker compose logs -f
# Stop and remove services
docker compose downCommon flow (quick routine)
docker compose up -d --build
docker compose ps
docker compose logs -f
# when done
docker compose downTips for juniors
- Keep container names simple (
--name api,--name db). - Use
docker psanddocker logs -f <name>as your first debug steps. - Prefer
docker composefor multi-service projects. - Run cleanup commands occasionally so Docker does not fill your disk.
Common errors and quick fixes
- Port already in use
Error usually looks like: bind: address already in use.
# See what is using port 3000
lsof -i :3000
# If it is a Docker container, stop it
docker ps
docker stop <container_name_or_id>
# Or run your app on another host port
docker run -d --name my-app -p 3001:3000 my-app:dev- Container name already in use
Error usually looks like: Conflict. The container name is already in use.
# Find container with the same name
docker ps -a
# Remove old container, then run again
docker rm <container_name>
# Or pick a different name
docker run -d --name my-app-v2 -p 3000:3000 my-app:dev- Cannot connect to Docker daemon
Error usually looks like: Cannot connect to the Docker daemon.
# Check Docker status
docker info
# On macOS, start Docker Desktop and wait until it says "Docker is running"
# Then retry your command
docker psIf docker info still fails, restart Docker Desktop and try again.
DMZ On-Premises Architecture – Technical Specification
Technical specification for on-premises DMZ architecture, including network segmentation, infrastructure components, security model, and deployment strategy.
Docker Compose Guide
Learn how to use Docker Compose to manage multi-container applications.