Created
March 10, 2019 15:10
-
-
Save gsw945/51a6f0c03580b1416b662e206035f15e to your computer and use it in GitHub Desktop.
Kitematic 's "Docker CLI" via cmd
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
| @echo off | |
| rem PowerShell 中查看所有环境变量的方法 | |
| rem (gci env:*).GetEnumerator() | Sort-Object Name | Out-String | |
| if not defined DOCKER_TOOLBOX_INSTALL_PATH ( | |
| rem DOCKER_TOOLBOX_INSTALL_PATH 为 docker.exe 和 docker-machine.exe 所在文件夹 | |
| echo 环境变量 DOCKER_TOOLBOX_INSTALL_PATH 不存在 | |
| echo 按任意键 退出 | |
| pause > nul | |
| exit | |
| ) else ( | |
| set DOCKER_MACHINE=%DOCKER_TOOLBOX_INSTALL_PATH%\docker-machine.exe | |
| ) | |
| if defined DOCKER_MACHINE_NAME ( | |
| set VM=%DOCKER_MACHINE_NAME% | |
| ) else ( | |
| set VM=default | |
| ) | |
| rem 需要转义, "" 表示 ", %% 表示 % | |
| for /f %%g in ('""%DOCKER_MACHINE%"" ip %%VM%%') do set IP=%%g | |
| for /f %%g in ('""%DOCKER_MACHINE%"" url %%VM%%') do set URL=%%g | |
| rem echo %DOCKER_MACHINE% | |
| rem echo %VM% | |
| rem echo IP: %IP% | |
| rem echo URL: %URL% | |
| set DOCKER_CERT_PATH=%userprofile%\.docker\machine\machines\%VM% | |
| set DOCKER_HOST=%URL% | |
| set DOCKER_TLS_VERIFY=1 | |
| start powershell.exe -executionpolicy bypass | |
| rem pause |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
参考:
https://github.com/docker/kitematic/blob/master/src/utils/DockerMachineUtil.js