Skip to content
Snippets Groups Projects
Commit fbd80963 authored by nimrod's avatar nimrod
Browse files

Podman, Docker and toolbx cleanup.

The workbench image now the `docker` CLI, `podman-remote` and `podman`
symlinked to `host-spawn`. They all work out of the box without any
added configuration. So split the config to `.bashrc.d/`, replace some
aliases that use `docker` locally with `podman`, remove useless config,
add the `docker` contexts and replace aliases using `docker` remotely
with contexts.
parent aa747a0b
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,6 @@ then ...@@ -37,7 +37,6 @@ then
fi fi
export CFLAGS="-g3 -Wall -Wextra -Wconversion -Wdouble-promotion -Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion -fsanitize=undefined -fsanitize-trap" export CFLAGS="-g3 -Wall -Wextra -Wconversion -Wdouble-promotion -Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion -fsanitize=undefined -fsanitize-trap"
export CLOUDSDK_ACTIVE_CONFIG_NAME='shore' export CLOUDSDK_ACTIVE_CONFIG_NAME='shore'
export DOCKER_BUILDKIT=1
export EDITOR=vim export EDITOR=vim
export GITLAB_BASE_URL='https://git.shore.co.il/api/v4' export GITLAB_BASE_URL='https://git.shore.co.il/api/v4'
export GITLAB_HOST='https://git.shore.co.il' export GITLAB_HOST='https://git.shore.co.il'
...@@ -85,7 +84,6 @@ alias ansible-local-playbook='ansible-playbook -i localhost, -c local -e "ansibl ...@@ -85,7 +84,6 @@ alias ansible-local-playbook='ansible-playbook -i localhost, -c local -e "ansibl
alias ansible-local='ansible localhost -c local -i localhost, -e "ansible_python_interpreter=$(which python3)"' alias ansible-local='ansible localhost -c local -i localhost, -e "ansible_python_interpreter=$(which python3)"'
alias aptitude='aptitude --display-format %p --quiet' alias aptitude='aptitude --display-format %p --quiet'
alias black='black --line-length 79' alias black='black --line-length 79'
alias cadvisor='docker run --rm --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --publish=8080:8080 --detach=true --name=cadvisor google/cadvisor:latest'
alias cdtemp='cd "$(mktemp -d)"' alias cdtemp='cd "$(mktemp -d)"'
alias check_tcp='nc -vzw10' alias check_tcp='nc -vzw10'
alias check_unix='nc -Uvzw3' alias check_unix='nc -Uvzw3'
...@@ -106,7 +104,6 @@ alias dpkglog="grep -v 'status\\|trigproc\\|configure' /var/log/dpkg.log" ...@@ -106,7 +104,6 @@ alias dpkglog="grep -v 'status\\|trigproc\\|configure' /var/log/dpkg.log"
alias gen-mac='hexdump -n5 -e '\''"02" 5/1 ":%02X" "\n"'\'' /dev/urandom' alias gen-mac='hexdump -n5 -e '\''"02" 5/1 ":%02X" "\n"'\'' /dev/urandom'
alias gen-ssh-config="rc_make .ssh/config" alias gen-ssh-config="rc_make .ssh/config"
alias hcl2json='json2hcl -reverse' alias hcl2json='json2hcl -reverse'
alias hostlocal='docker run --rm --privileged --net=host docker.io/gliderlabs/hostlocal'
alias jjb='jenkins-jobs' alias jjb='jenkins-jobs'
alias l='ls -F' alias l='ls -F'
alias la='ls -AF' alias la='ls -AF'
...@@ -121,36 +118,14 @@ alias missing-suggests="aptitude search '~RBsuggests:~i'" ...@@ -121,36 +118,14 @@ alias missing-suggests="aptitude search '~RBsuggests:~i'"
alias monitor="monitor " alias monitor="monitor "
alias mvhere='mv --target-directory=./' alias mvhere='mv --target-directory=./'
# shellcheck disable=SC1004 # shellcheck disable=SC1004
alias netdata='docker run --detach \
--name netdata \
--cap-add SYS_PTRACE \
--volume netdatalib:/var/lib/netdata \
--volume netdatacache:/var/cache/netdata \
--volume /etc/os-release:/host/etc/os-release:ro \
--volume /etc/passwd:/host/etc/passwd:ro \
--volume /etc/group:/host/etc/group:ro \
--volume /proc:/host/proc:ro \
--volume /sys:/host/sys:ro \
--volume /var/run/docker.sock:/var/run/docker.sock \
--publish 19999:19999 \
--security-opt apparmor=unconfined \
docker.io/netdata/netdata'
# shellcheck disable=SC1004
alias newman='docker run --rm \
-u "$(id -u):$(id -g)" \
-v "$PWD:/etc/newman" \
-t \
docker.io/postman/newman_alpine33'
alias nextcloudcmd='flatpak run --command=nextcloudcmd com.nextcloud.desktopclient.nextcloud' alias nextcloudcmd='flatpak run --command=nextcloudcmd com.nextcloud.desktopclient.nextcloud'
# shellcheck disable=SC2139 # shellcheck disable=SC2139
alias notify="notify --hint \"string:desktop-entry:$(basename "${GIO_LAUNCHED_DESKTOP_FILE:-io.elementary.terminal.desktop}")\"" alias notify="notify --hint \"string:desktop-entry:$(basename "${GIO_LAUNCHED_DESKTOP_FILE:-io.elementary.terminal.desktop}")\""
alias obsolete='apt list "~o"' alias obsolete='apt list "~o"'
alias occ='docker --host=ssh://host01.shore.co.il exec -itu www-data nextcloud-nextcloud-1 ./occ'
alias pre-commit-update-skel='pre-commit autoupdate --config ~/.config/git/skel/.pre-commit-config.yaml' alias pre-commit-update-skel='pre-commit autoupdate --config ~/.config/git/skel/.pre-commit-config.yaml'
# shellcheck disable=SC2139 # shellcheck disable=SC2139
alias rc_make="make --directory $HOME --always-make" alias rc_make="make --directory $HOME --always-make"
alias rc_update="rc_make vendored generated" alias rc_update="rc_make vendored generated"
alias reg='ssh ns4.shore.co.il docker exec registry_reg_1 reg'
alias restart-kodi='ssh kodi.shore.co.il "sudo systemctl kill --kill-who=all --signal=9 xorg.service"' alias restart-kodi='ssh kodi.shore.co.il "sudo systemctl kill --kill-who=all --signal=9 xorg.service"'
# shellcheck disable=SC2032 # shellcheck disable=SC2032
alias rm='rm --dir' alias rm='rm --dir'
...@@ -160,8 +135,6 @@ alias sudome="sudome " ...@@ -160,8 +135,6 @@ alias sudome="sudome "
alias todo="vim \$HOME/Documents/TODO.yml" alias todo="vim \$HOME/Documents/TODO.yml"
# shellcheck disable=SC2142 # shellcheck disable=SC2142
alias tolower='awk "{print tolower(\$0)}"' alias tolower='awk "{print tolower(\$0)}"'
alias torrent_off='ssh kodi.shore.co.il docker container pause transmission_rss_1 transmission_daemon_1'
alias torrent_on='ssh kodi.shore.co.il docker container unpause transmission_rss_1 transmission_daemon_1'
# shellcheck disable=SC2142 # shellcheck disable=SC2142
alias toupper='awk "{print toupper(\$0)}"' alias toupper='awk "{print toupper(\$0)}"'
alias transmission-remote='forward kodi.shore.co.il 9091:localhost:9091 && transmission-remote' alias transmission-remote='forward kodi.shore.co.il 9091:localhost:9091 && transmission-remote'
...@@ -407,25 +380,5 @@ then ...@@ -407,25 +380,5 @@ then
! command -v direnv > /dev/null || eval "$(direnv hook bash)" ! command -v direnv > /dev/null || eval "$(direnv hook bash)"
fi fi
if [ ! -S /var/run/docker.sock ] &&
[ -z "${DOCKER_HOST:-}" ] &&
[ -S "/run/host/run/docker.sock" ] &&
[ -w "/run/host/run/docker.sock" ]
then
export DOCKER_HOST="unix:///run/host/run/docker.sock"
fi
if [ "$HOSTNAME" = 'toolbox' ]
then
alias flatpak-spawn='/usr/libexec/flatpak-xdg-utils/flatpak-spawn --host'
gio () { /usr/libexec/flatpak-xdg-utils/flatpak-spawn --host gio "$@"; }
if [ -S "$XDG_RUNTIME_DIR/podman/podman.sock" ] && [ -w "$XDG_RUNTIME_DIR/podman/podman.sock" ]
then
alias podman='podman --remote'
export DOCKER_HOST=unix://"$XDG_RUNTIME_DIR/podman/podman.sock"
export CONTAINER_HOST=unix://"$XDG_RUNTIME_DIR/podman/podman.sock"
fi
fi
# shellcheck disable=SC2119 # shellcheck disable=SC2119
prune_ssh_sockets prune_ssh_sockets
# shellcheck shell=bash
# vim: ft=sh
export DOCKER_BUILDKIT=1
alias hostlocal='docker run --rm --privileged --net=host docker.io/gliderlabs/hostlocal'
alias occ='docker --context=host01 exec -itu www-data nextcloud-nextcloud-1 ./occ'
alias reg='docker --context=ns4 exec registry-reg-1 reg'
alias torrent-off='docker --context=kodi container pause transmission-rss-1 transmission-daemon-1'
alias torrent-on='docker --context=kodi container unpause transmission-rss-1 transmission-daemon-1'
# shellcheck shell=bash
# vim: ft=sh
alias cadvisor='podman run --rm --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --publish=8080:8080 --detach=true --name=cadvisor google/cadvisor:latest'
alias netdata='docker run --detach \
--name netdata \
--cap-add SYS_PTRACE \
--volume netdatalib:/var/lib/netdata \
--volume netdatacache:/var/cache/netdata \
--volume /etc/os-release:/host/etc/os-release:ro \
--volume /etc/passwd:/host/etc/passwd:ro \
--volume /etc/group:/host/etc/group:ro \
--volume /proc:/host/proc:ro \
--volume /sys:/host/sys:ro \
--volume /var/run/docker.sock:/var/run/docker.sock \
--publish 19999:19999 \
--security-opt apparmor=unconfined \
docker.io/netdata/netdata'
# shellcheck disable=SC1004
alias newman='docker run --rm \
-u "$(id -u):$(id -g)" \
-v "$PWD:/etc/newman" \
-t \
docker.io/postman/newman_alpine33'
# shellcheck shell=bash
# vim: ft=sh
if [ "$HOSTNAME" = 'toolbox' ] || [ -f "/run/.toolboxenv" ]
then
alias flatpak-spawn='/usr/libexec/flatpak-xdg-utils/flatpak-spawn --host'
gio () { /usr/libexec/flatpak-xdg-utils/flatpak-spawn --host gio "$@"; }
fi
{"Name":"host01","Metadata":{},"Endpoints":{"docker":{"Host":"ssh://host01.shore.co.il","SkipTLSVerify":false}}}
\ No newline at end of file
{"Name":"ns4","Metadata":{},"Endpoints":{"docker":{"Host":"ssh://ns4.shore.co.il","SkipTLSVerify":false}}}
\ No newline at end of file
{"Name":"kodi","Metadata":{},"Endpoints":{"docker":{"Host":"ssh://kodi.shore.co.il","SkipTLSVerify":false}}}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment