docker-machine env
可以输出cmd或者powershell的环境。输出包括用于在 shell 中设置环境的命令的注释。
命令
C:\> docker-machine env --shell cmd manager11
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:/Users/matt/.docker/machine/machines/manager11
SET DOCKER_MACHINE_NAME=manager11
REM Run this command to configure your shell:
REM @FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd manager11') DO @%i
电源外壳
PS C:\> docker-machine env --shell powershell manager11
$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://192.168.99.100:2376"
$Env:DOCKER_CERT_PATH = "C:/Users/matt/.docker/machine/machines/manager11"
$Env:DOCKER_MACHINE_NAME = "manager11"
# Run this command to configure your shell:
# & docker-machine env --shell powershell manager11 | Invoke-Expression