Skip to content

Instantly share code, notes, and snippets.

@auwsom
Last active December 17, 2020 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save auwsom/fbeb8bfd36af91bb482529ee499f1058 to your computer and use it in GitHub Desktop.
Save auwsom/fbeb8bfd36af91bb482529ee499f1058 to your computer and use it in GitHub Desktop.
bash setup for docker
# wget https://gist.github.com/auwsom/fbeb8bfd36af91bb482529ee499f1058/raw -O bashsetup_docker ; bash !$
set +o history && sleep 1
sed -i /^'alias d'/d ~/.bashrc; sed -i /^'function d'/d ~/.bashrc ## remove old
source ~/.bashrc ; exec bash ## have to restart shell to enter the bindings without recursion
#echo "HISTIGNORE=''" >>~/.bashrc
# sudo cp /usr/share/zoneinfo/US/Pacific /etc/localtime # cant set, read only
echo "alias d='docker'">>~/.bashrc
echo "alias dcm='docker commit'">>~/.bashrc # CONTAINER IMAGE_REPO:TAG <- have to specify or creates new image
echo "alias del='docker exec -it \$(docker ps -q -l) bash'">>~/.bashrc
echo "alias di='docker images'">>~/.bashrc
echo "alias dl='\$(docker ps -q -l)'">>~/.bashrc
echo "alias dp='docker ps -a'">>~/.bashrc
echo "alias drrm='docker run -it --rm'">>~/.bashrc
echo "alias drm='docker rm'">>~/.bashrc
echo "alias drmi='docker rmi'">>~/.bashrc
echo "alias drme='docker rm \$(docker ps -qa --no-trunc --filter "status=exited")'">>~/.bashrc
echo "alias drml='docker rm \$(docker ps -q -l)'">>~/.bashrc
echo "alias ds='docker start'">>~/.bashrc
echo "alias dst='docker stop'">>~/.bashrc
echo "alias dsl='docker start \$(docker ps -q -l)'">>~/.bashrc
echo "alias dstl='docker stop \$(docker ps -q -l)'">>~/.bashrc
echo "alias dgo='docker docker exec -it $k /sbin/my_init'">>~/.bashrc
echo "function dc { docker create -it \$1 bash; }; ">>~/.bashrc #
echo "function de { docker exec -it \$1 bash; }; ">>~/.bashrc #
echo "function dr { docker run -d \$1 /bin/bash; }; ">>~/.bashrc
source ~/.bashrc
set -o history
# docker create -it -v /home/user/Data:/root//Data <container> /bin/bash
# docker run -d --restart always -v "Data:/root//Data" IMAGE
# docker container update --restart="no" <your container name>
# docker container update --restart="always" <your container name>
# docker cp foo.txt mycontainer:/foo.txt
# docker tag old new
# echo "alias ex='$(echo "export k='\$a'">>~/.bashrc)'">>~/.bashrc
# echo "export k='\$a'">>~/.bashrc
# echo 'aaa'>|temp.txt ; a=$(read -r first<temp.txt) ; { echo $first; }
:'
https://serverfault.com/questions/386871/getting-5d-when-hitting-ctrl-arrow-key-in-a-terminal-on-freebsd
$include /etc/inputrc ## in ~/.inputrc on remote machine, then: source ~/.bashrc ; exec bash
'
:'
startup-script
#! /bin/bash
echo "starting"
docker start thirsty_lehmann
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment