if ! [ -w '/var/run/docker.sock' ]; then
    alias docker='sudo docker'
    alias docker-compose='sudo docker-compose'
fi

# docker
alias dk='docker'

## container
alias dkcc='docker container create'
alias dkci='docker container inspect'
alias dkcls='docker container ls'
alias dkclsa='docker container ls -a'
alias dkclsaq='docker container ls -a -q'
alias dkclsq='docker container ls -q'
alias dkcp='docker container prune'
alias dkcp!='docker container prune -f'
alias dkcrm='docker container rm'
alias dkcrm!='docker container rm -f'
alias dkcsp='docker container stop'
alias dkcst='docker container restart'
alias dkex='docker container exec -i -t'
alias dklo='docker logs -f'
alias dkr='docker run -i -t'

## image
alias dkb='docker build .'
alias dki='docker image'
alias dkic='docker image create'
alias dkii='docker image inspect'
alias dkil='docker pull'
alias dkila="docker image ls | grep -v none | awk '{print \"docker pull \" \$1 \":\" \$2}' | $SHELL"
alias dkils='docker image ls'
alias dkilsa='docker image ls -a'
alias dkilsaq='docker image ls -a -q'
alias dkilsq='docker image ls -q'
alias dkip='docker image prune'
alias dkip='docker image push'
alias dkip!='docker image prune -f'
alias dkirm='docker image rm'
alias dkirm!='docker image rm -f'
alias dkis='docker image save'
alias dkit='docker image tag'

## volume
alias dkv='docker volume'
alias dkvc='docker volume create'
alias dkvi='docker volume inspect'
alias dkvls='docker volume ls'
alias dkvlsq='docker volume ls -q'
alias dkvp='docker volume prune'
alias dkvp!='docker volume prune -f'
alias dkvrm='docker volume rm'
alias dkvrm!='docker volume rm -f'

## network
alias dkn='docker network'
alias dknc='docker network create'
alias dkni='docker network inspect'
alias dknls='docker network ls'
alias dknlsq='docker network ls -q'
alias dknp='docker network prune'
alias dknpf='docker network prune -f'
alias dknrm='docker network rm'
alias dknrm!='docker network rm -f'

## system
alias dks='docker system'
alias dksdf='docker system df'
alias dksp!='docker system prune -f'
alias dksp='docker system prune'
alias dkspa='docker system prune -a'
alias dkspaf='docker system prune -a -f'
alias dkspv!='docker system prune --volumes -f'
alias dkspv='docker system prune --volumes'
alias dkspva='docker system prune --volumes -a'
alias dkspvaf='docker system prune --volumes -a -f'

# docker-compose
alias dc='docker-compose'
alias dcd='docker-compose down'
alias dcup='docker-compose up -d'
alias dcupb='docker-compose up -d --build'

## container
alias dccls='docker-compose ps'
alias dcclsq='docker-compose ps -q'
alias dcex='docker-compose exec'
alias dcr='docker-compose run --rm'
alias dcrd='docker-compose run -d --rm'
alias dcrm!='docker-compose rm -f'
alias dcrm='docker-compose rm'
alias dcrmv!='docker-compose rm -v -f'
alias dcrmv='docker-compose rm -v'
alias dcsp='docker-compose stop'
alias dcst='docker-compose restart'

## image
alias dcb!='docker-compose build --no-cache'
alias dcb='docker-compose build'
alias dcl='docker-compose pull'
