3 This plugin adds auto-completion and aliases for [docker](https://www.docker.com/).
5 To use it add `docker` to the plugins array in your zshrc file.
11 A copy of the completion script from the docker/cli git repo:
12 https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
16 By default, the completion doesn't allow option-stacking, meaning if you try to
17 complete `docker run -it <TAB>` it won't work, because you're _stacking_ the
18 `-i` and `-t` options.
20 [You can enable it](https://github.com/docker/cli/commit/b10fb43048) by **adding
21 the lines below to your zshrc file**, but be aware of the side effects:
23 > This enables Zsh to understand commands like `docker run -it
24 > ubuntu`. However, by enabling this, this also makes Zsh complete
25 > `docker run -u<tab>` with `docker run -uapprox` which is not valid. The
26 > users have to put the space or the equal sign themselves before trying
29 > Therefore, this behavior is disabled by default. To enable it:
32 > zstyle ':completion:*:*:docker:*' option-stacking yes
33 > zstyle ':completion:*:*:docker-*:*' option-stacking yes
38 | Alias | Command | Description |
39 | :------ | :-------------------------- | :--------------------------------------------------------------------------------------- |
40 | dbl | `docker build` | Build an image from a Dockerfile |
41 | dcin | `docker container inspect` | Display detailed information on one or more containers |
42 | dlo | `docker container logs` | Fetch the logs of a docker container |
43 | dcls | `docker container ls` | List all the running docker containers |
44 | dclsa | `docker container ls -a` | List all running and stopped containers |
45 | dpo | `docker container port` | List port mappings or a specific mapping for the container |
46 | dpu | `docker pull` | Pull an image or a repository from a registry |
47 | dr | `docker container run` | Create a new container and start it using the specified command |
48 | drit | `docker container run -it` | Create a new container and start it in an interactive shell |
49 | drm | `docker container rm` | Remove the specified container(s) |
50 | drm! | `docker container rm -f` | Force the removal of a running container (uses SIGKILL) |
51 | dst | `docker container start` | Start one or more stopped containers |
52 | dstp | `docker container stop` | Stop one or more running containers |
53 | dtop | `docker top` | Display the running processes of a container |
54 | dxc | `docker container exec` | Run a new command in a running container |
55 | dxcit | `docker container exec -it` | Run a new command in a running container in an interactive shell |
56 | | | **Docker Images** |
57 | dib | `docker image build` | Build an image from a Dockerfile (same as docker build) |
58 | dii | `docker image inspect` | Display detailed information on one or more images |
59 | dils | `docker image ls` | List docker images |
60 | dipu | `docker image push` | Push an image or repository to a remote registry |
61 | dirm | `docker image rm` | Remove one or more images |
62 | dit | `docker image tag` | Add a name and tag to a particular image |
63 | | | **Docker Network** |
64 | dnc | `docker network create` | Create a new network |
65 | dncn | `docker network connect` | Connect a container to a network |
66 | dndcn | `docker network disconnect` | Disconnect a container from a network |
67 | dni | `docker network inspect` | Return information about one or more networks |
68 | dnls | `docker network ls` | List all networks the engine daemon knows about, including those spanning multiple hosts |
69 | dnrm | `docker network rm` | Remove one or more networks |
70 | | | **Docker Volume** |
71 | dvi | `docker volume inspect` | Display detailed information about one or more volumes |
72 | dvls | `docker volume ls` | List all the volumes known to docker |
73 | dvprune | `docker volume prune` | Cleanup dangling volumes |