Code Monkey home page Code Monkey logo

zsh-docker-aliases's Introduction

ZSH Docker Aliases

Defines Docker aliases and functions.

How to Install

With zplug

zplug "akarzim/zsh-docker-aliases"

With Oh My Zsh:

git clone https://github.com/akarzim/zsh-docker-aliases.git  ~/.oh-my-zsh/custom/plugins/zsh-docker-aliases
# then add `zsh-docker-aliases` to `plugins` in your .zshrc

With zinit

zinit light akarzim/zsh-docker-aliases

Aliases

Docker

  • dk is short for docker
  • dka Attach to a running container
  • dka! Attach to a running container by name
  • dkb Build an image from a Dockerfile
  • dkd Inspect changes on a container's filesystem
  • dkdf Show docker filesystem usage
  • dke Run a command in a running container
  • dkE Run an interactive command in a running container
  • dkE! Run an interactive command in a running container by name
  • dkh Show the history of an image
  • dki List images
  • dkin Return low-level information on a container, image or task
  • dkk Kill a running container
  • dkkh Send kill -s HUP signal to a running container
  • dkl Fetch the logs of a container
  • dkL Fetch and follow (-f) the logs of a container
  • dkli Log in to a Docker registry
  • dklo Log out from a Docker registry
  • dkls is alias for dkps
  • dkp Pause all processes within one or more containers
  • dkP Unpause all processes within one or more containers
  • dkpl Pull an image or a repository from a registry
  • dkplI Pull all tagged images
  • dkph Push an image or a repository to a registry
  • dkps List containers
  • dkps! Display the first matching docker container ID by name
  • dkpsa List all containers (default lists just running)
  • dkr Run a command in a new container
  • dkR Run an interactive command in a new container and automatically remove the container when it exits
  • dkRe like dkR and set entry point to /bin/bash
  • dkrm Remove one or more containers
  • dkrmi Remove one or more images
  • dkrmC Clean up exited containers
  • dkrmI Clean up dangling images
  • dkrmV Clean up unused volumes ( Docker >= 1.9 )
  • dkrn Rename a container
  • dks Start one or more stopped containers
  • dkS Restart a container
  • dkss Display a live stream of container(s) resource usage statistics
  • dksv Save one or more images to a tar archive (streamed to STDOUT by default)
  • dkt Tag an image into a repository
  • dktop Display the running processes of a container
  • dkup Update configuration of one or more containers
  • dkV Manage Docker volumes
  • dkv Show the Docker version information
  • dkw Block until a container stops, then print its exit code
  • dkx Stop a running container

container (C)

  • dkC Manage containers
  • dkCa Attach to a running container
  • dkCcp Copy files/folders between a container and the local filesystem
  • dkCd Inspect changes on a container's filesystem
  • dkCe Run a command in a running container
  • dkCE Run an interactive command in a running container
  • dkCin Display detailed information on one or more containers
  • dkCk Kill one or more running containers
  • dkCl Fetch the logs of a container
  • dkCL Fetch and follow (-f) the logs of a container
  • dkCls List containers
  • dkCp Pause all processes within one or more containers
  • dkCpr Remove all stopped containers
  • dkCrn Rename a container
  • dkCS Restart one or more containers
  • dkCrm Remove one or more containers
  • dkCr Run a command in a new container
  • dkCR Run an interactive command in a new container and automatically remove the container when it exits
  • dkCRe like dkCR and set entry point to /bin/bash
  • dkCs Start one or more stopped containers
  • dkCss Display a live stream of container(s) resource usage statistics
  • dkCx Stop one or more running containers
  • dkCtop Display the running processes of a container
  • dkCP Unpause all processes within one or more containers
  • dkCup Update configuration of one or more containers
  • dkCw Block until one or more containers stop, then print their exit codes

image (I)

  • dkI Manage images
  • dkIb Build an image from a Dockerfile
  • dkIh Show the history of an image
  • dkIim Import the contents from a tarball to create a filesystem image
  • dkIin Display detailed information on one or more images
  • dkIls List images
  • dkIpr Remove unused images
  • dkIpl Pull an image or a repository from a registry
  • dkIph Push an image or a repository to a registry
  • dkIrm Remove one or more images
  • dkIsv Save one or more images to a tar archive (streamed to STDOUT by default)
  • dkIt Tag an image into a repository

volume (V)

  • dkV Manage volumes
  • dkVin Display detailed information on one or more volumes
  • dkVls List volumes
  • dkVpr Remove all unused volumes
  • dkVrm Remove one or more volumes

network (N)

  • dkN Manage networks
  • dkNs Connect a container to a network
  • dkNx Disconnects a container from a network
  • dkNin Displays detailed information on a network
  • dkNls Lists all the networks created by the user
  • dkNpr Remove all unused networks
  • dkNrm Deletes one or more networks

system (Y)

  • dkY Manage Docker
  • dkYdf Show docker filesystem usage
  • dkYpr Remove unused data

stack (K)

  • dkK Manage Docker stacks
  • dkKls List stacks
  • dkKps List the tasks in the stack
  • dkKrm Remove the stack

swarm (W)

  • dkW Manage Docker Swarm

Docker Machine

  • dkm is short for docker-machine
  • dkma Get or set the active machine
  • dkmcp Copy files between machines
  • dkmd Set up the default machine ; alowing you to use dkme without arguments
  • dkme Set up the environment for the Docker client (eg: dkme staging to toggle to staging)
  • dkmin Inspect information about a machine
  • dkmip Get the IP address of a machine
  • dkmk Kill a machine
  • dkmls List machines
  • dkmpr Re-provision existing machines
  • dkmps is alias for dkmls
  • dkmrg Regenerate TLS Certificates for a machine
  • dkmrm Remove a machine
  • dkms Start a machine
  • dkmsh Log into or run a command on a machine with SSH
  • dkmst Get the status of a machine
  • dkmS Restart a machine
  • dkmu Get the URL of a machine
  • dkmup Upgrade a machine to the latest version of Docker
  • dkmv Show the Docker Machine version or a machine docker version
  • dkmx Stop a machine

Docker Compose

Note from docker-compose v1.29.2: Except for the Linux platform, Docker Compose is now in the Docker CLI.

  • dkc is short for docker-compose
  • dkcb Build or rebuild services
  • dkcB Build or rebuild services and do not use cache when building the image
  • dkccp Copy files/folders between a service container and the local filesystem
  • dkccr Creates containers for a service
  • dkccv Converts the compose file to platform's canonical format
  • dkcd Stop and remove containers, networks, images, and volumes
  • dkce Execute a command in a running container
  • dkcev Receive real time events from containers
  • dkci List images used by the created containers
  • dkck Kill containers
  • dkcl View output from containers
  • dkcL View and follow (-f) output from containers
  • dkcls List running compose projects (or alias to dkcps under Linux)
  • dkcp Pause services
  • dkcP Unpause services
  • dkcpl Pull service images
  • dkcph Push service images
  • dkcpo Print the public port for a port binding
  • dkcps List containers
  • dkcr Run a one-off command
  • dkcR Run a one-off command and remove container after run.
  • dkcrm Remove stopped containers
  • dkcs Start services
  • dkcsc Set number of containers for a service
  • dkcS Restart services
  • dkct Display the running processes
  • dkcu Create and start containers
  • dkcU Create and start containers in detached mode: Run containers in the background, print new container names
  • dkcv Show the Docker-Compose version information
  • dkcx Stop services

Author

The author of this module should be contacted via the issue tracker.

zsh-docker-aliases's People

Contributors

akarzim avatar identifysun avatar malikoth avatar mathieutu avatar micahelliott avatar richardudovich avatar sh-cho avatar uilian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

zsh-docker-aliases's Issues

Handy wrapper for docker-compose exec

Hello, it's neat zsh-plugin, but what about to add one more thing:
Its common to login into already running container:

$ docker-compose exec postgres /bin/bash -l

May be something like this?

$ dkclo postgres

autoload functions

dkme, dkmd functions are defined in docker-aliases.plugin.zsh. This slows down startup and increases memory overhead. They should be in a dir in fpath and autoloaded so they are only defined when used. The plugin file should put this dir in fpath and autoload all the function files. This is zsh best practice.

Unable to install using zplug

For some reason I'm unable to install zsh-docker-aliases on one of my laptops. Here's an attempt:

[zplug] Loaded from cache (/home/stian/.zplug/cache)
WARNING:  Failed to load "~/.zplug/repos/akarzim/zsh-docker-aliases/docker-aliases.plugin.zsh" (akarzim/zsh-docker-aliases)
WARNING:  Failed to load "~/.zplug/repos/akarzim/zsh-docker-aliases/zsh-docker-aliases.plugin.zsh" (akarzim/zsh-docker-aliases)
[zplug] Run compinit
➜  ~ rm -rf .zplug/repos/akarzim                    
➜  ~ type restartshell 
restartshell is an alias for exec -l /usr/bin/zsh
➜  ~ restartshell
- akarzim/zsh-docker-aliases: not installed
Install? [y/N]: y
[zplug] Start to install 1 plugins in parallel

 ✘  Unknown error         akarzim/zsh-docker-aliases

[zplug] Elapsed time: 1.1829 sec.
 ==> Installation finished successfully!
WARNING:  Failed to load "~/.zplug/repos/akarzim/zsh-docker-aliases/docker-aliases.plugin.zsh" (akarzim/zsh-docker-aliases)
WARNING:  Failed to load "~/.zplug/repos/akarzim/zsh-docker-aliases/zsh-docker-aliases.plugin.zsh" (akarzim/zsh-docker-aliases)
[zplug] Run compinit
➜  ~ ll .zplug/repos/akarzim/zsh-docker-aliases 
total 36K
drwxrwxr-x 3 stian stian 4,0K des.  19 17:19 .
drwxrwxr-x 3 stian stian 4,0K des.  19 17:19 ..
-rw-rw-r-- 1 stian stian 6,8K des.  19 17:19 docker-aliases.plugin.zsh
drwxrwxr-x 8 stian stian 4,0K des.  19 17:19 .git
-rw-rw-r-- 1 stian stian 1,1K des.  19 17:19 LICENSE
-rw-rw-r-- 1 stian stian 7,2K des.  19 17:19 README.md
-rw-rw-r-- 1 stian stian  255 des.  19 17:19 zsh-docker-aliases.plugin.zsh
➜  ~ zplug "akarzim/zsh-docker-aliases"
[zplug] akarzim/zsh-docker-aliases: already managed
➜  ~ zsh --version
zsh 5.5.1 (x86_64-ubuntu-linux-gnu)
➜  ~ uname -a
Linux ** 4.18.0-13-generic #14-Ubuntu SMP Wed Dec 5 09:04:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
➜  ~ zplug --version
2.4.2

Any tips for how I can debug this? Thanks!

Commands dont work

I cloned the repo into my zsh plugins folder (in this case) ~/.oh-my-zsh/plugins but I get an error saying it couldn't load completions from the zsh-docker-aliases. But that isn't an issue. I add the zsh-docker-aliases to the plugin list in my .zshrc file and source it but None of the commands work.

zplug can't find repo

zplug load akarzim/zsh-docker-aliases, from:github won't load the repo, and zplug update shows "Repo not found". I've update zplug to the latest version. I've also tried specifying

# rave at rave-thinkpad in ~/CropMask_RCNN/app on git:return_geo ✖︎ [14:14:07]
→ zplug update                                      
[zplug] Start to update 9 plugins in parallel

 ✔  Up-to-date            skywind3000/z.lua
 ✘  Repo not found        akarzim/zsh-docker-aliases
 ✔  Up-to-date            plugins/docker
 ✔  Up-to-date            webyneter/docker-aliases
 ✔  Up-to-date            unixorn/docker-helpers.zshplugin
 ✔  Up-to-date            zsh-users/zsh-autosuggestions
 ✔  Up-to-date            oskarkrawczyk/honukai-iterm-zsh
 ✔  Up-to-date            zplug/zplug
 ✔  Up-to-date            plugins/git


Remove use of multiple single options

Zsh's completion doesn't work well for some aliases that have multiple options grouped together, like for this case:

docker run -it -<TAB> # OOPS! gets a bunch of file names instead of options

But it's fine for:

docker run -i -t -<TAB>

So the aliases should rather use the second form. I'm new to these aliases, but I've just observed this with dkR -<TAB> and see that the double-single-option usage is common in these aliases, particularly the -it combo. I'll submit a PR if it you agree there's no harm in separating them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.