From 3e8f34830245be483c92a594c4a0533785596d27 Mon Sep 17 00:00:00 2001 From: Brad Ganley Date: Sat, 24 Feb 2024 00:44:14 +0000 Subject: [PATCH] moving docker specific aliases to their own file. Will do the same with other command groupings eventually --- .bash_aliases | 43 +++++++++++++++++++++++-------------------- .bash_docker | 20 ++++++++++++++++++++ 2 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 .bash_docker diff --git a/.bash_aliases b/.bash_aliases index cf5b697..a7f309c 100755 --- a/.bash_aliases +++ b/.bash_aliases @@ -108,26 +108,29 @@ alias mnts='mount | column -t' # The history command but shorter alias h='history' -# Lazy docker composing. Set the variable somewhere. -alias doco="$DOCKER_COMPOSE_COMMAND" -alias redoco="$DOCKER_COMPOSE_COMMAND down && $DOCKER_COMPOSE_COMMAND up -d" -alias redog="$DOCKER_COMPOSE_COMMAND down && $DOCKER_COMPOSE_COMMAND up -d; $DOCKER_COMPOSE_COMMAND logs -f" -alias dolog="$DOCKER_COMPOSE_COMMAND up -d; $DOCKER_COMPOSE_COMMAND logs -f" -alias watchtower="docker run -d --restart unless-stopped --name 'watch-$(date +%H%M)' -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower " -alias watchonce="docker run -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once" -alias onetower="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once" -alias docport='docker container ls --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}" -a' -# Regain all that space taken up by projects you abandoned -alias docprune='echo "Pruning images"; docker image prune -f && echo "Pruning networks"; docker network prune -f && echo "Pruning containers"; docker container prune -f && echo "Pruning Volumes"; docker volume prune -f' -# Send things instantly to a pastebin. Pipe other commands into this to share their output. -alias bin='nc termbin.com 9999' -# Quicker Docker exec -alias dex='docker exec' -alias dps="docker ps --format 'CONTAINER ID: {{.ID}}\nIMAGE: {{.Image}}\nCOMMAND: {{.Command}}\nCREATED: {{.CreatedAt}}\nSTATUS: {{.Status}}\nPORTS: {{.Ports}}\nNAMES: {{.Names}}\n'|cat" -alias lzd='docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v ~/lzd:/.config/jesseduffield/lazydocker lazyteam/lazydocker' -alias doctime="docker ps --format 'CONTAINER NAME: {{.Names}}\nUPTIME: {{.Status}}'|cat" -alias glance='docker run --rm -e TZ="${TZ}" -v /var/run/docker.sock:/var/run/docker.sock:ro -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro --pid host --network host -it nicolargo/glances:latest-full' -alias ytdlp='docker run --rm -v "/nasty/ytdl:/media" -it jauderho/yt-dlp:latest ' + +##### moved to .bash_docker will be removed in next commit ##### + +## Lazy docker composing. Set the variable somewhere. +#alias doco="$DOCKER_COMPOSE_COMMAND" +#alias redoco="$DOCKER_COMPOSE_COMMAND down && $DOCKER_COMPOSE_COMMAND up -d" +#alias redog="$DOCKER_COMPOSE_COMMAND down && $DOCKER_COMPOSE_COMMAND up -d; $DOCKER_COMPOSE_COMMAND logs -f" +#alias dolog="$DOCKER_COMPOSE_COMMAND up -d; $DOCKER_COMPOSE_COMMAND logs -f" +#alias watchtower="docker run -d --restart unless-stopped --name 'watch-$(date +%H%M)' -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower " +#alias watchonce="docker run -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once" +#alias onetower="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once" +#alias docport='docker container ls --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}" -a' +## Regain all that space taken up by projects you abandoned +#alias docprune='echo "Pruning images"; docker image prune -f && echo "Pruning networks"; docker network prune -f && echo "Pruning containers"; docker container prune -f && echo "Pruning Volumes"; docker volume prune -f' +## Send things instantly to a pastebin. Pipe other commands into this to share their output. +#alias bin='nc termbin.com 9999' +## Quicker Docker exec +#alias dex='docker exec' +#alias dps="docker ps --format 'CONTAINER ID: {{.ID}}\nIMAGE: {{.Image}}\nCOMMAND: {{.Command}}\nCREATED: {{.CreatedAt}}\nSTATUS: {{.Status}}\nPORTS: {{.Ports}}\nNAMES: {{.Names}}\n'|cat" +#alias lzd='docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v ~/lzd:/.config/jesseduffield/lazydocker lazyteam/lazydocker' +#alias doctime="docker ps --format 'CONTAINER NAME: {{.Names}}\nUPTIME: {{.Status}}'|cat" +#alias glance='docker run --rm -e TZ="${TZ}" -v /var/run/docker.sock:/var/run/docker.sock:ro -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro --pid host --network host -it nicolargo/glances:latest-full' +#alias ytdlp='docker run --rm -v "/nasty/ytdl:/media" -it jauderho/yt-dlp:latest ' # Misc # Get the weather. Put your location after the command alias wttr='ansiweather -u imperial -s false -l' diff --git a/.bash_docker b/.bash_docker new file mode 100644 index 0000000..0d0b52c --- /dev/null +++ b/.bash_docker @@ -0,0 +1,20 @@ +export DOCKER_COMPOSE_COMMAND="docker compose" + +# Lazy docker composing. Set the variable somewhere. +alias doco="$DOCKER_COMPOSE_COMMAND" +alias redoco="$DOCKER_COMPOSE_COMMAND down && $DOCKER_COMPOSE_COMMAND up -d" +alias redog="$DOCKER_COMPOSE_COMMAND down && $DOCKER_COMPOSE_COMMAND up -d; $DOCKER_COMPOSE_COMMAND logs -f" +alias dolog="$DOCKER_COMPOSE_COMMAND up -d; $DOCKER_COMPOSE_COMMAND logs -f" +alias watchtower="docker run -d --restart unless-stopped --name 'watch-$(date +%H%M)' -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower " +alias watchonce="docker run -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once" +alias onetower="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once" +alias docport='docker container ls --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}" -a' + +alias docprune='echo "Pruning images"; docker image prune -f && echo "Pruning networks"; docker network prune -f && echo "Pruning containers"; docker container prune -f && echo "Pruning Volumes"; docker volume prune -f' # Regain all that space taken up by projects you abandoned +alias bin='nc termbin.com 9999' # Send things instantly to a pastebin. Pipe other commands into this to share their output. +alias dex='docker exec' # Quicker Docker exec +alias dps="docker ps --format 'CONTAINER ID: {{.ID}}\nIMAGE: {{.Image}}\nCOMMAND: {{.Command}}\nCREATED: {{.CreatedAt}}\nSTATUS: {{.Status}}\nPORTS: {{.Ports}}\nNAMES: {{.Names}}\n'|cat" +alias lzd='docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v ~/lzd:/.config/jesseduffield/lazydocker lazyteam/lazydocker' +alias doctime="docker ps --format 'CONTAINER NAME: {{.Names}}\nUPTIME: {{.Status}}'|cat" +alias glance='docker run --rm -e TZ="${TZ}" -v /var/run/docker.sock:/var/run/docker.sock:ro -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro --pid host --network host -it nicolargo/glances:latest-full' +alias ytdlp='docker run --rm -v "/nasty/ytdl:/media" -it jauderho/yt-dlp:latest '