summaryrefslogtreecommitdiff
path: root/conf.d/99-docker.zsh
blob: ce6381dc95fa8fb38923ed793d736806cf9798cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
alias d=docker
alias dc=docker-compose

alias dtop='d stats $(d ps --format={{.Names}})'
alias ctop='d run -it --name ctop --rm -v /var/run/docker.sock:/var/run/docker.sock:ro quay.io/vektorlab/ctop:latest'
alias dlog='d logs --follow --timestamps --tail=10000'

dadopt() {
  local remote="$1"

  # Assumes your home directory has sane permissions,
  # in order to prevent other local users from gaining
  # effective root on the adopted machine
  local sock="$HOME/.cache/dadopt/$remote.sock"
  mkdir -p "$(dirname $sock)"
  unlink "$sock"

  ssh -nNT -L "$sock:/var/run/docker.sock" "$remote" &
  export DOCKER_HOST="unix://$sock"
}