Skip to content

Instantly share code, notes, and snippets.

@snehesht
Last active November 22, 2024 21:03
Show Gist options
  • Save snehesht/5cfa5885208a633e4826 to your computer and use it in GitHub Desktop.
Save snehesht/5cfa5885208a633e4826 to your computer and use it in GitHub Desktop.
Automates the process of switching the docker-machine environments
:: Author: Snehesh Thalapaneni
:: Description: Automates the process of switching the docker-machine environments. Just type in the machine name the script will setup the environment for you.
:: Compatable with Windows x86, x64 systems
@echo off
if [%1]==[] goto help
echo @echo off >> temp_config.bat
docker-machine env --shell cmd %1 | findstr /v # >> temp_config.bat
echo exit /B >> temp_config.bat
call temp_config.bat
del temp_config.bat
echo "docker-machine environment is setup."
GOTO:EOF
:help
@echo Usage: %0 DOCKER_MACHINE_NAME
@echo example: run " docker-machine ls " and you'll find the docker-machine-name
EXIT /B 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment