Dotfiles/site-modules/core/files/oh-my-zsh/custom/docker.zsh
Ade Attwood 80239af169 refactor(core): start to make dotfiles public
This is the first commit that brings the privet dotfiles to a public
reop previously this was all one puppet module. Now this has been split
out so I can put all of the private files in a private puppet module
2020-09-20 06:22:17 +01:00

42 lines
914 B
Bash

#
# Docker
#
alias dk="docker"
alias dkl="docker logs -f"
alias dkps="docker ps --format '{{.ID}} ~ {{.Names}} ~ {{.Status}} ~ {{.Image}}' | column -t -s'~'"
alias dkrm="docker rm"
function dke() {
#
# Get the container name you want to execute in
#
local container="$1"
#
# Shift the params so we can pass the rest to the container
#
shift
#
# Run the command in the container
#
docker exec -it $container /bin/bash -c "$@"
}
function dklogin() {
docker exec -it $1 /bin/sh -c "[ -e /bin/bash ] && /bin/bash || /bin/sh"
}
function dktop() {
docker stats --format "table {{.Container}}\t{{.Name}}\t{{.CPUPerc}} {{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}"
}
#
# Docker Compose
#
alias dkc="docker-compose"
alias dkcdown="docker-compose down"
alias dkcup="docker-compose up -d"
function dkcrestart() {
docker-compose stop $1
docker-compose up -d $1
}