10 Useful Docker Commands, Aliased
Note
Original content copied from Foundry81 GitHub: https://github.com/Foundry81/aliases
Purpose:
- Improve day-to-day Docker visibility
- Reduce context switching and typo-driven mistakes
- Make common inspection tasks fast and repeatable
Safety Legend:
- 🟢 Safe - Read-only, no side effects
- 🟡 Caution - Informational, often followed by cleanup actions
- 🔴 Dangerous- Can remove data or disrupt services
Source explicitly. Do NOT auto-load unless you understand each alias.
Core Visibility & Status
🟢 Live CPU, memory, network, and disk I/O stats for running containers
alias dstats='docker stats'
🟢 Human-readable list of running containers
alias dps='docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Image}}"'
🟢 List all containers, including stopped ones
alias dpsa='docker ps -a'
Inspection & Runtime Metadata
🟢 Full container inspection (config, mounts, env, networks)
alias dinspect='docker inspect'
🟢 Output a container's internal IP address
alias dip='docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}"'
🟢 Show the configured restart policy for a container
alias drestart='docker inspect -f "{{.HostConfig.RestartPolicy.Name}}"'
🟢 Show processes running inside a container
alias dtop='docker top'
Logs & Live Debugging
🟢 Follow container logs in real time
alias dlogs='docker logs -f'
🟢 Follow logs starting with the last 50 lines
alias dlogs50='docker logs -f --tail 50'
🟢 Show the last 100 log lines without following
alias dlogs100='docker logs --tail 100'
🟢 Interactive shell into a running container
alias dexec='docker exec -it'
Networking Visibility
🟢 List Docker networks
alias dnetls='docker network ls'
🟢 Inspect Docker network configuration and attachments
alias dneti='docker network inspect'
Images & Build Insight
🟡 List local Docker images
alias dmages='docker images'
🟢 Show image layer history (spot bloat)
alias dimgh='docker history'
🟢 Inspect image metadata and entrypoints
alias dimgi='docker image inspect'
🟡 List dangling (untagged) images
alias dimgd='docker images -f "dangling=true"'
Storage & Volume Insight
🟡 Inspect volume configuration and metadata
alias dvolinspect='docker volume inspect'
🟢 Show host filesystem path for a volume
alias dvolmount='docker volume inspect -f "{{.Mountpoint}}"'
🟢 Display volume driver and scope
alias dvoldriver='docker volume inspect -f "Driver: {{.Driver}} / Scope: {{.Scope}}"'
🟡 List unused volumes
alias dvoldangling='docker volume ls -f "dangling=true"'
🟡 Verbose disk usage, including per-volume size
alias ddfv='docker system df -v'
Disk Usage & Cleanup
🟡 Docker disk usage summary
alias ddf='docker system df'
🔴 Remove stopped containers, unused networks, and dangling images
alias dprune='docker system prune'
🔴 Remove all unused images (forces rebuilds)
alias dprunea='docker system prune -a'
🔴 Permanently delete unused volumes (data loss)
alias dvolprune='docker volume prune'