From e6112e623ad33b59536d45ea48bf9b0e7dd3bb71 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 23 Oct 2014 00:34:42 +0800 Subject: [PATCH 1/2] Add docker useful alias --- plugins/docker/docker.plugin.zsh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 plugins/docker/docker.plugin.zsh diff --git a/plugins/docker/docker.plugin.zsh b/plugins/docker/docker.plugin.zsh new file mode 100644 index 000000000..8cca680f3 --- /dev/null +++ b/plugins/docker/docker.plugin.zsh @@ -0,0 +1,29 @@ +# Show only the latest created container ID +alias dl="docker ps -l -q" + +# Show all containers +alias ds="docker ps -a" + +# List images +alias dim="docker images" + +# Check IP Address of specific container +alias dip="docker inspect --format=\"{{ .NetworkSettings.IPAddress }}\"" + +# Remove all containers. +drm() { docker rm $(docker ps -q -a); } + +# Stop all containers +dst() { docker stop $(docker ps -q -a); } + +# Kill all running containers. +alias dockerkillall='docker kill $(docker ps -q)' + +# Delete all stopped containers. +alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)' + +# Delete all untagged images. +alias dockercleani='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)' + +# Delete all stopped containers and untagged images. +alias dockerclean='dockercleanc || true && dockercleani' From 80e37e1207d39c3fb783aa4bf93f273d454129ec Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 23 Oct 2014 00:47:46 +0800 Subject: [PATCH 2/2] Add 1st_arguments for docker 1.3.0 --- plugins/docker/_docker | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 28568a6e5..27805d3b5 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -247,20 +247,23 @@ _1st_arguments=( "build":"Build a container from a Dockerfile" "commit":"Create a new image from a container's changes" "cp":"Copy files/folders from the containers filesystem to the host path" + "create":"Create a new container" "diff":"Inspect changes on a container's filesystem" "events":"Get real time events from the server" + "exec":"Run a command in an existing container" "export":"Stream the contents of a container as a tar archive" "history":"Show the history of an image" "images":"List images" "import":"Create a new filesystem image from the contents of a tarball" "info":"Display system-wide information" - "insert":"Insert a file in an image" "inspect":"Return low-level information on a container" "kill":"Kill a running container" "load":"Load an image from a tar archive" "login":"Register or Login to the docker registry server" + "logout":"Log out from a Docker registry server" "logs":"Fetch the logs of a container" "port":"Lookup the public-facing port which is NAT-ed to PRIVATE_PORT" + "pause":"Pause all processes within a container" "ps":"List containers" "pull":"Pull an image or a repository from the docker registry server" "push":"Push an image or a repository to the docker registry server" @@ -274,6 +277,7 @@ _1st_arguments=( "stop":"Stop a running container" "tag":"Tag an image into a repository" "top":"Lookup the running processes of a container" + "unpause":"Unpause a paused container" "version":"Show the docker version information" "wait":"Block until a container stops, then print its exit code" )