Skip to content

Instantly share code, notes, and snippets.

View docker_wlsg.sh
#!/bin/bash
#https://www.reddit.com/r/bashonubuntuonwindows/comments/n2nthu/comment/gwo9mvz/?utm_source=share&utm_medium=web2x&context=3
#https://marinerobotics.gtorg.gatech.edu/running-ros-with-gui-in-docker-using-windows-subsystem-for-linux-2-wsl2/
docker run -it <image:tag> -e DISPLAY -e WAYLAND_DISPLAY -e XDG_RUNTIME_DIR -e PULSE_SERVER -v /tmp/.X11-unix:/tmp/.X11-unix -v /mnt/wslg:/mnt/wslg <executable>
@moracabanas
moracabanas / nvidia-run.sh
Created Nov 14, 2021
Nvidia optimized docker run helper script
View nvidia-run.sh
#!/bin/bash
# https://github.com/awslabs/benchmark-ai/issues/17
docker run -it --rm --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 \
nvcr.io/nvidia/$image:$tag
@moracabanas
moracabanas / docker-build.sh
Created Nov 14, 2021
Docker build, tag and push helper script
View docker-build.sh
#!/bin/bash
image="repo/image"
#get timestamp for the tag
timestamp=$(date +%Y.%m.%d.%H.%M.%S)
tag=$image:$timestamp
latest=$image:latest
View install-docker.sh
#!/bin/bash
apt update
sudo apt install docker.io
systemctl enable --now docker
@moracabanas
moracabanas / deploy.sh
Created Jan 2, 2021
.env on Docker Swarm deployments
View deploy.sh
# You can define stack name on your .env or do deploy.sh <stack_name>
export $(cat .env) > /dev/null 2>&1;
docker stack deploy -c docker-compose.yml ${1:-STACK_NAME}
@moracabanas
moracabanas / .bash_aliases
Last active Dec 23, 2020
Run your favorite tools as ephemeral containers
View .bash_aliases
# This check ensures <drun-network> exist
# every <drun> container will be reachable by it service name
# https://stackoverflow.com/a/53052379
function docker_network_check {
docker network inspect drun-network >/dev/null 2>&1 || \
docker network create --driver bridge drun-network
}
# You can run containered resources whithout the need of intalling it bloating your system