Skip to content

Instantly share code, notes, and snippets.

@parmindersk
Last active February 19, 2019 01:18
Show Gist options
  • Save parmindersk/976d26fcbeac61963da74ca21e8bf19f to your computer and use it in GitHub Desktop.
Save parmindersk/976d26fcbeac61963da74ca21e8bf19f to your computer and use it in GitHub Desktop.
Shortcut commands for docker
# Remove exited instances
alias drm="docker ps -a | grep 'Exit\|Created' | cut -d ' ' -f 1 | xargs docker rm"
# View Network details
alias dinw="docker network inspect bridge"
# List images
alias dlsi="docker images"
# List containers
alias dpsa="docker ps -a"
# Remove given image
dirm(){ docker image rm $1 --force; }
# Bash into a container
dexec(){ docker exec -it $1 bash; }
# Stop docker container
dstop(){ docker stop $1; }
# Stop and remove
dstopr(){ docker stop $1; docker rm $1; }
# Start container
dstart(){ docker start $1; }
# Pull a docker image
dpull(){ docker pull $1; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment