Home

Awesome

dockerfiles

A collection of delicious docker recipes.

Affiliates

Todo

Big Data

IoT

Automation

Machine Learning

Cluster

Monitor

Daemon

Utility

Media

Audio

Web

E-commerce

Security

Proxy

VPN

DNS

3rd-party (sorted by basename)

auto-completion

#!/bin/bash
#
# handy auto-completion for docker-exec
#

enter() {
  local name=${1:?}
  docker exec -it $name sh -c 'exec $(command -v bash || command -v sh)'
}

__enter() {
  local cur=${COMP_WORDS[COMP_CWORD]}
  for cid in $(docker ps -q)
  do
    local name=$(docker inspect -f '{{.Name}}' $cid)
    name=${name#/}
    if [[ $name = $cur* ]]
    then
      COMPREPLY+=("$name")
    fi
  done
}

complete -F __enter enter

Star History

Star History Chart