Last active
September 4, 2017 15:03
-
-
Save codeZoner/a351825533be976ff259363ed409be1f to your computer and use it in GitHub Desktop.
Docker Machine save Machine State Mac OS X
This file contains hidden or 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
#Docker Auto Evaluate Machine | |
VM_STATUS="$(docker-machine status default 2>&1)" | |
if [ "${VM_STATUS}" == "Running" ]; then | |
eval "$(docker-machine env --shell=bash default)" | |
fi |
This file contains hidden or 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/bash | |
# Ref: http://tachesimazzoca.github.io/wiki/docker/machine.html | |
# Tested on Docker Toolbox installed via Homebrew | |
# Create a VirtualBox machine named as "default" | |
docker-machine create -d virtualbox --virtualbox-memory 2048 --virtualbox-disk-size 204800 default | |
# Start the Machine | |
docker-machine start default | |
#GET ENV | |
docker-machine env --shell=bash default | |
#Echo Env onto the terminal session | |
eval "$(docker-machine env --shell=bash default)" | |
# Explore the virtual machine with SSH | |
#docker-machine ssh default | |
## Make Necessary Changes -- and then exit ssh example: | |
# vi /etc/sysctl.conf | |
# Save the machine state for the sake of later use | |
VBoxManage controlvm default savestate | |
# Restart the virtual machine "default", set env | |
docker-machine restart && eval "$(docker-machine env default)" | |
#To Confirm that changes are persistant, browse the machine to view if changes are saved | |
#docker-machine ssh default | |
# Clean up the virtual machine "default" | |
#docker-machine rm -f default | |
#rm -rf ~/.docker/machine/machines/default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment