Skip to content

Instantly share code, notes, and snippets.

@kozak127
Last active January 5, 2021 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kozak127/9d009940c772abf0e3381c1a81b7b768 to your computer and use it in GitHub Desktop.
Save kozak127/9d009940c772abf0e3381c1a81b7b768 to your computer and use it in GitHub Desktop.
OSX CMD Docker DockerCompose Toolchain
# paste this into .zshrc/.bashrc
# check if `docker-machine` command exists
if command -v docker-machine > /dev/null; then
# fetch the first running machine name
local machine=$(docker-machine ls | grep "Running" | head -n 1 | awk '{ print $1 }')
if [ "$machine" != "" ]; then
eval "$(docker-machine env $machine)"
fi
fi
#!/bin/bash
cd ~/Tools/docker/
docker-machine start default
docker-machine env
eval $(docker-machine env)
docker-compose up
#!/bin/bash
# troubleshooting
# https://medium.com/crowdbotics/a-complete-one-by-one-guide-to-install-docker-on-your-mac-os-using-homebrew-e818eb4cfc3
# https://docs.docker.com/machine/drivers/virtualbox/
brew install docker docker-machine
brew install --cask virtualbox
# need password
# possibly need to address System Preference setting
# after changing settings, run script again
docker-machine create -d virtualbox --virtualbox-disk-size "128000" --virtualbox-memory "8192" --virtualbox-cpu-count 6 --virtualbox-hostonly-cidr "192.168.98.1/24" default
echo '192.168.98.100 dockerhost' | sudo tee -a /etc/hosts
sudo killall -HUP mDNSResponder
# need password, DO NOT rerun script
docker-machine env default
eval "$(docker-machine env default)"
docker run hello-world
docker-machine stop default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment