DOCKER for Windows - Open cmd executing docker machine env

扶醉桌前 提交于 2019-12-12 03:37:06

问题


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".



来源:https://stackoverflow.com/questions/38569624/docker-for-windows-open-cmd-executing-docker-machine-env

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!