Last active
February 24, 2023 10:31
-
-
Save gcamerli/b8cf836f8627cb285f33086db10096a2 to your computer and use it in GitHub Desktop.
Shell script to properly setup docker inside 42 clusters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# sh docker_setup.sh | |
# Assuming you’re using zsh and you’ve already installed | |
# VirtualBox from MSC | |
LOGIN=$(whoami) | |
# Setup Brew | |
curl -fsSL https://rawgit.com/gcamerli/42brew/master/set.sh | zsh | |
# Setup docker from Brew | |
brew install docker | |
brew install docker-machine | |
# Check docker version | |
docker version | |
docker-machine version | |
# Create a default docker machine | |
docker-machine create --driver virtualbox default | |
docker-machine ls | |
# Create a personal dir in sgoinfre | |
rm -rf ~/goinfre | |
mkdir /sgoinfre/goinfre/Perso/$LOGIN | |
chmod 700 /sgoinfre/goinfre/Perso/$LOGIN | |
# Create symbolic links | |
ln -s /sgoinfre/goinfre/Perso/$LOGIN ~/goinfre | |
mv ~/.docker ~/goinfre | |
mv ~/VirtualBox\ VMs ~/goinfre | |
ln -s ~/goinfre/.docker ~/.docker | |
ln -s ~/goinfre/VirtualBox\ VMs ~/VirtualBox\ VMs | |
# Set docker env variables | |
cat >> ~/.zshrc << EOF | |
# Set docker env variables | |
eval $(docker-machine env default) | |
EOF | |
# Update your rc file | |
source ~/.zshrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment