├── darwin-amd64.tar.gz ├── linux-amd64.tar.gz ├── completions └── docker-wrapper ├── darwin-amd64 └── docker-wrapper ├── linux-amd64 └── docker-wrapper ├── uninstall.sh ├── main.go ├── LICENSE ├── install.sh ├── HELP └── README.md /darwin-amd64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clarketm/docker-wrapper/HEAD/darwin-amd64.tar.gz -------------------------------------------------------------------------------- /linux-amd64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clarketm/docker-wrapper/HEAD/linux-amd64.tar.gz -------------------------------------------------------------------------------- /completions/docker-wrapper: -------------------------------------------------------------------------------- 1 | # TODO: create custom completions 2 | complete -F _docker docker-wrapper 3 | -------------------------------------------------------------------------------- /darwin-amd64/docker-wrapper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clarketm/docker-wrapper/HEAD/darwin-amd64/docker-wrapper -------------------------------------------------------------------------------- /linux-amd64/docker-wrapper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clarketm/docker-wrapper/HEAD/linux-amd64/docker-wrapper -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | BIN_DIR="/usr/local/bin" 4 | SCRIPT='docker-wrapper' 5 | 6 | # Remove script 7 | sudo rm -f "$BIN_DIR/$SCRIPT" 8 | echo "$SCRIPT succesfully uninstalled" 9 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin 2 | 3 | package main 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "path/filepath" 9 | "runtime" 10 | "syscall" 11 | ) 12 | 13 | func main() { 14 | _, callPath, _, _ := runtime.Caller(0) 15 | binary := fmt.Sprintf("%s/%s-%s/docker-wrapper", filepath.Dir(callPath), runtime.GOOS, runtime.GOARCH) 16 | env := os.Environ() 17 | syscall.Exec(binary, os.Args, env) 18 | } 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Travis Clarke (https://www.travismclarke.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | OS=$(uname -s) 4 | ARCH=$(uname -m) 5 | 6 | BIN_DIR="/usr/local/bin" 7 | SCRIPT='docker-wrapper' 8 | 9 | DARWIN='darwin' 10 | LINUX='linux' 11 | 12 | ARCH_64='amd64' 13 | 14 | BUILD_DIR= 15 | 16 | # Check operating system 17 | case "$OS" in 18 | [Dd]arwin*) 19 | BUILD_DIR="$DARWIN" 20 | ;; 21 | [Ll]inux*) 22 | BUILD_DIR="$LINUX" 23 | ;; 24 | *) 25 | echo "unknown operating system: $OS" >&2 26 | exit 1 27 | ;; 28 | esac 29 | echo "$OS operating system detected" 30 | 31 | # Check machine architecture 32 | case "$ARCH" in 33 | [Xx]86*|[Xx]86[-_]64*) 34 | BUILD_DIR="$BUILD_DIR-$ARCH_64" 35 | ;; 36 | *) 37 | echo "unknown machine architecture: $ARCH" >&2 38 | exit 1 39 | ;; 40 | esac 41 | echo "$ARCH machine architecture detected" 42 | 43 | # Make directory (if doesn't exist) 44 | if [ ! -d "$BIN_DIR" ]; then 45 | echo "creating directory $BIN_DIR" 46 | sudo mkdir -p "$BIN_DIR" 47 | fi 48 | 49 | copy_script () { 50 | echo "copying $BUILD_DIR/$SCRIPT to $BIN_DIR" 51 | sudo cp -f "$BUILD_DIR/$SCRIPT" "$BIN_DIR" 52 | } 53 | 54 | # Copy script 55 | if ! type "$SCRIPT" > /dev/null 2>&1; then 56 | copy_script 57 | else 58 | read -r -p "$SCRIPT already exists on your PATH. Do you still want to install? [N/y] " REPLY 59 | if [ "$REPLY" = 'y' ] || [ "$REPLY" = 'Y' ]; then 60 | copy_script 61 | else 62 | echo "setup aborted" >&2 63 | exit 1 64 | fi 65 | fi 66 | -------------------------------------------------------------------------------- /HELP: -------------------------------------------------------------------------------- 1 | 2 | 3 | NAME: 4 | docker-wrapper – docker command wrapper. 5 | 6 | 7 | SYNOPSIS: 8 | docker-wrapper subcommand [opts...] 9 | 10 | 11 | SUB COMMANDS: 12 | 13 | b, build Build an image from a Dockerfile. 14 | 15 | e, exec Run a command in a running container. 16 | -b, --bash Execute bash in a running container. 17 | -i, --interactive Execute command in interactive container. 18 | -s, --shell Execute sh in a running container. 19 | 20 | g, go Navigate to a docker internal storage dicetory (Linux ONLY). 21 | 22 | i, images List images. 23 | -d, --dangling List all dangling images. 24 | -v, --verbose List all images (non-truncated output). 25 | 26 | ip List IP address(es) for container. 27 | 28 | p, ps List containers. 29 | 30 | prune Remove unused resources. 31 | -a, --all Remove all unused resources (containers, images, networks, volumes). 32 | c, containers Remove all unused containers. 33 | i, images Remove all unused images. 34 | n, networks Remove all unused networks. 35 | v, volumes Remove all unused volumes. 36 | 37 | rm Remove one or more containers. 38 | -a, --all Remove all containers. 39 | -e, --exited Remove all exited containers. 40 | -r, --running Remove all running containers. 41 | 42 | rmi Remove one or more images. 43 | -a, --all Remove all base images. 44 | -d, --dangling Remove all dangling images. 45 | -i, --intermediate Remove all images (both base AND intermediate). 46 | 47 | r, run Run a command in a new container. 48 | -i, --interactive Run interactive container. 49 | 50 | s, stop Stop one or more running containers. 51 | -a, --all Stop all processes/containers. 52 | 53 | w, wrapper Docker wrapper specific options. 54 | -h, --help Print usage information. 55 | -v, --version Print version number. 56 | cs, cheatsheet Print docker command reference guide. 57 | 58 | 59 | MANAGEMENT COMMANDS: 60 | 61 | cnf, conf, cnfg, config Manage containers. 62 | 63 | c, container Manage containers. 64 | 65 | im, img, image Manage images. 66 | 67 | n, net, network Manage networks. 68 | 69 | no, node Manage Swarm node. 70 | 71 | se, svc, service Manage services. 72 | 73 | st, stack Manage Docker stacks. 74 | 75 | sw, swarm Manage Swarm. 76 | 77 | v, vol, volume Manage volumes. 78 | ls List volumes. 79 | -d, --dangling List all dangling volumes. 80 | rm Remove one or more volumes. 81 | -d, --dangling Remove all dangling volumes. 82 | 83 | 84 | EXAMPLES: 85 | docker-wrapper wrapper --help 86 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [docker-wrapper](https://godoc.org/github.com/clarketm/docker-wrapper) 2 | Docker command wrapper. 3 | 4 | > The `docker-wrapper` command is a **complete** superset of the `docker` command. It is a wrapper that shims the native `docker` command with useful aliases and helpers to enhance your docker workflow. This may go without saying, but `docker` is a required dependency for `docker-wrapper`. 5 | 6 | ## Installation 7 | 8 | #### Golang 9 | ```shell 10 | $ go get -u github.com/clarketm/docker-wrapper 11 | ``` 12 | 13 | #### Install script 14 | ```shell 15 | $ git clone "https://github.com/clarketm/docker-wrapper.git" 16 | $ cd docker-wrapper && sudo sh install.sh 17 | ``` 18 | 19 | ## Usage 20 | ```bash 21 | $ docker-wrapper wrapper --help 22 | ``` 23 | 24 | ```text 25 | 26 | NAME: 27 | docker-wrapper – docker command wrapper. 28 | 29 | 30 | SYNOPSIS: 31 | docker-wrapper subcommand [opts...] 32 | 33 | 34 | SUB COMMANDS: 35 | 36 | b, build Build an image from a Dockerfile. 37 | 38 | e, exec Run a command in a running container. 39 | -b, --bash Execute bash in a running container. 40 | -i, --interactive Execute command in interactive container. 41 | -s, --shell Execute sh in a running container. 42 | 43 | g, go Navigate to a docker internal storage dicetory (Linux ONLY). 44 | 45 | i, images List images. 46 | -d, --dangling List all dangling images. 47 | -v, --verbose List all images (non-truncated output). 48 | 49 | ip List IP address(es) for container. 50 | 51 | p, ps List containers. 52 | 53 | prune Remove unused resources. 54 | -a, --all Remove all unused resources (containers, images, networks, volumes). 55 | c, containers Remove all unused containers. 56 | i, images Remove all unused images. 57 | n, networks Remove all unused networks. 58 | v, volumes Remove all unused volumes. 59 | 60 | rm Remove one or more containers. 61 | -a, --all Remove all containers. 62 | -e, --exited Remove all exited containers. 63 | -r, --running Remove all running containers. 64 | 65 | rmi Remove one or more images. 66 | -a, --all Remove all base images. 67 | -d, --dangling Remove all dangling images. 68 | -i, --intermediate Remove all images (both base AND intermediate). 69 | 70 | r, run Run a command in a new container. 71 | -i, --interactive Run interactive container. 72 | 73 | s, stop Stop one or more running containers. 74 | -a, --all Stop all processes/containers. 75 | 76 | w, wrapper Docker wrapper specific options. 77 | -h, --help Print usage information. 78 | -v, --version Print version number. 79 | cs, cheatsheet Print docker command reference guide. 80 | 81 | 82 | MANAGEMENT COMMANDS: 83 | 84 | cnf, conf, cnfg, config Manage containers. 85 | 86 | c, container Manage containers. 87 | 88 | im, img, image Manage images. 89 | 90 | n, net, network Manage networks. 91 | 92 | no, node Manage Swarm node. 93 | 94 | se, svc, service Manage services. 95 | 96 | st, stack Manage Docker stacks. 97 | 98 | sw, swarm Manage Swarm. 99 | 100 | v, vol, volume Manage volumes. 101 | ls List volumes. 102 | -d, --dangling List all dangling volumes. 103 | rm Remove one or more volumes. 104 | -d, --dangling Remove all dangling volumes. 105 | 106 | 107 | EXAMPLES: 108 | docker-wrapper wrapper --help 109 | 110 | ``` 111 | 112 | ## TODO (before v1.0.0 release): 113 | - [x] Cross-platform compilation for Darwin and Linux 114 | - [ ] Add completions 115 | --------------------------------------------------------------------------------