我一直在追问这个问题,以迫使docker-machine创建具有特定地址Is there a way to force docker-machine to create vm with a specific ip?的vm,因为我需要docker-machine在192.168.99.100上工作。它似乎适用于所有人,但不适用于我,我认为对于Windows Home解决它可能会有所帮助
我正在使用:
Windows 10 Home build
Virtual Box Versión 5.2.8 r121009 (Qt5.6.2)
$ docker version
Client:
Version: 18.03.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 0520e24302
Built: Fri Mar 23 08:31:36 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm
error during connect: Get https://192.168.99.101:2376/v1.37/version: dial tcp 192.168.99.101:2376: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
usuario@DESKTOP-GTCQCAR MINGW64 /c/Program Files/Docker Toolbox
$ echo "ifconfig eth0 192.168.99.100 netmask 255.255.255.0 broadcast 192.168.99.255 up" | docker-machine ssh default su
do tee /var/lib/boot2docker/bootsync.sh > /dev/null
tee: C:/Program: No such file or directory
tee: Files/Git/var/lib/boot2docker/bootsync.sh: No such file or directory
exit status 1
该命令的第二部分不起作用:
docker-machine ssh默认sudo tee /var/lib/boot2docker/bootsync.sh> / dev / null
该脚本也不起作用:C:\ Program Files \ Docker Toolbox> dmvbf默认为99 100
@echo off
setlocal enabledelayedexpansion
set machine=%1
if "%machine%" == "" (
echo dmvbf expects a machine name
exit /b 1
)
set ipx=%2
if "%ipx%" == "" (
echo dmvbf x missing ^(for 192.168.x.y^)
exit /b 2
)
set ipy=%3
if "%ipy%" == "" (
echo dmvbf y missing ^(for 192.168.x.y^)
exit /b 3
)
echo kill $(more /var/run/udhcpc.eth0.pid) | docker-machine ssh %machine% sudo tee /var/lib/boot2docker/bootsync.sh >NUL
echo ifconfig eth0 192.168.%ipx%.%ipy% netmask 255.255.255.0 broadcast 192.168.%ipx%.255 up | docker-machine ssh %machine% sudo tee -a /var/lib/boot2docker/bootsync.sh >NUL
echo route add default gw <gateway ip address here> | docker-machine ssh %machine% sudo tee /bar/lib/boot2docker/bootsync.sh >NUL
docker-machine ssh %machine% "sudo cat /var/run/udhcpc.eth0.pid | xargs sudo kill"
docker-machine ssh %machine% "sudo ifconfig eth0 192.168.%ipx%.%ipy% netmask 255.255.255.0 broadcast 192.168.%ipx%.255 up"
说
C:\Program Files\Docker Toolbox>dmvbf default 99 100
Error: Cannot run SSH command: Host "default" is not running
Error: Cannot run SSH command: Host "default" is not running
Not expected | at this momment.
谢谢
答案 0 :(得分:0)
您面临的错误似乎是不言自明的:计算机“默认”似乎不存在或未运行。
首先,通过在提升的Powershell中键入以下内容来确保机器存在:
docker-machine ls
如果看到机器,请键入以下内容以确保其正在运行:
docker-machine start MyMachineName
否则,创建一个新的:
docker-machine create MyMachineName
其失败的另一个原因是在创建docker-machine时未设置正确的虚拟开关。
希望这会有所帮助