Skip to content

A list of nice bash functions to save time while using docker.

License

Notifications You must be signed in to change notification settings

gfnord/docker_aliases

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

docker_aliases

A list of nice bash functions to save time while using docker.

Add this content on your ~/.bash_profile, ~/.zshrc.local or similar

dockerstop() { docker stop $(docker ps -a -q) }
dockerrm() { docker rm $(docker ps -a -q) }
dockerrmi() { docker rmi $(docker images -q) -f }
dockerclean() { dockerstop; dockerrm; dockerrmi;}
dockerexec() { docker exec -it $(docker ps -qa -f "name=$1_1") ${2:-bash} }

What does each command?

dockerstop

Well, stops all containers.

dockerrm

Yellow Alert: This will destroy all containers.

dockerrmi

Red Alert: This will delete all images located on you docker.

dockerclean

Double Red Alert: This will stop all containers, then will destroy all containers and remove all images stored on you docker.

dockerexec

This is cool, helps you get a shell in a container. Where $1 is the name of the container and the $2 is the shell

Note: If $2 is not provided 'bash' will be assumed as default

$ dockerexec mysql_container_1
$ dockerexec mysql_container_1 bash

Credits to https://github.com/DiSiqueira

About

A list of nice bash functions to save time while using docker.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published