Last Updated: February 25, 2016
·
880
· srgrn

Use docker-machine env in CMD

docker-machine is very linux oriented even though it works fine in windows.
one of the first steps is to ensure that you can run docker-machine without any issues as explained in their documantation.

this tip requires sed to be in your path along with the rest of docker-machine required tools

put the following commands into a batch file:

@echo off
set DOCKERENV=%1
echo @echo off > %TEMP%\%DOCKERENV%.bat 
docker-machine.exe env %DOCKERENV% >> %TEMP%\%DOCKERENV%.bat
sed -i 's/export/set/' %TEMP%\%DOCKERENV%.bat
sed -i 's,\\\\\\\\,\\\\,g' %TEMP%\%DOCKERENV%.bat
sed -i 's,",,g' %TEMP%\%DOCKERENV%.bat 
sed -i 's,#,rem,g' %TEMP%\%DOCKERENV%.bat
%TEMP%\%DOCKERENV%.bat %% del %TEMP%\%DOCKERENV%.bat