DOCKER for Windows - Open cmd executing docker mac

2019-09-05 01:33发布

问题:

I'm using Docker For Windows ( not Dokcer toolbox ) and it is running with HyperV.

So, every time I open a new CMD, I need to run "docker-machine env" and define variables for shell following the command response :

REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('docker-machine env') DO @%i

Could i create a shortcut for open CMD executing this commands.

Obs. I wouldn´t like to install a plugin or app for better command shell..

If anybody has a suggestions, Thanks! :)

回答1:

Also, in my case I need to start in a specific folder.

Putting the command bellow in "Shorcut Properties > target" works perfectly for me :

%windir%\system32\cmd.exe /K "cd c:\docker & docker-machine env & @FOR /f "tokens=*" %i IN ('docker-machine env') DO @%i"



回答2:

I'm not exactly certain I understand your question. It hasn't been my experience that need to do anything special when I open a command prompt. The docker commands are available "out of the box".