我一直在关注这个问题来强制 docker-machine 创建具有特定地址的虚拟机有没有办法强制 docker-machine 创建具有特定 IP 的虚拟机? https://stackoverflow.com/questions/34336218/is-there-a-way-to-force-docker-machine-to-create-vm-with-a-specific-ip因为我需要 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 default 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.
Thanks