Skip to content

Instantly share code, notes, and snippets.

@loopmode

loopmode/.bashrc

Last active Oct 1, 2020
Embed
What would you like to do?
dockerized ubuntu shell
dockerized-ubuntu() { dockerized ubuntu ubuntu:latest /bin/bash bash }
dockerized-curl() { dockerized curl pstauffer/curl:latest /bin/sh sh }
# based on https://stackoverflow.com/a/56690087/368254
dockerized()
{
name=$1
image=$2
containercmd=$3
runcmd=$4
dir=~/.dockerized-$name
mkdir -p $dir
cd $dir
cat << EOF > ./docker-compose.yml
version: "3.7"
services:
$name:
image: $image
command: $containercmd
tty: true
EOF
printf "Now entering the container...\n"
docker-compose run $name $runcmd
docker-compose down
rm -rf $dir
}
@loopmode

This comment has been minimized.

Copy link
Owner Author

@loopmode loopmode commented Aug 29, 2019

gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment