boot2docker 下载地址
https://github.com/boot2docker/boot2docker/releases
Docker-Machine 下载地址
http://github.com/docker/machine/releases
配置项
C:\ProgramData\docker\config
--设置配置
sc config docker binpath= ""C:\Program Files\docker\dockerd.exe" --run-service -H tcp://0.0.0.0:2375"
sc config docker binpath= ""C:\Program Files\docker\dockerd.exe" --data-root "F:\SoftTool\Docker\data-root"
sc config docker binpath= ""C:\Program Files\docker\dockerd.exe" --experimental true
windows 安装docker 安装说明 使用 virtualbox 虚拟机
https://www.cnblogs.com/52fhy/p/8413029.html
默认用户名是docker,密码tcuser
安装说明 hyperv-virtual-switch
https://www.linuxidc.com/Linux/2017-02/141062.htm
1、登录到 虚拟机的docker环境
cmd cd到 docker-machine 目录下
docker-machine ssh vm8
powerShell 环境
登录到docker虚拟机环境 PS F:\SoftTool\Docker\docker-machine\v0.16.2>.\docker-machine ssh vm8
2、共享目录 F:\SoftTool\Docker\data-root 到容器虚拟机中
docker run -it -v F:\SoftTool\Docker\data-root :\test alpine sh
创建Docker machine
在管理员cmd环境里进入到docker-machine.exe所在的文件夹
运行命令的格式如下:
docker-machine create -d hyperv --hyperv-virtual-switch "<NameOfVirtualSwitch>" <nameOfNode>
安装命令
docker-machine create -d hyperv --hyperv-virtual-switch "DockNAT" VM8
把当前主机设置为默认docker命令运行的主机,根据提示,我们运行下面命令
docker-machine.exe env VM8
运行命令: @FOR /f "tokens=*" %i IN ('docker-machine env vm8') DO @%i
完成后,运行命令: docker version 查看主机信息
重新生成我的证书命令:
docker-machine regenerate-certs VM8 --VM8虚拟机名称
主机重启ip地址修改后
错误提示 :
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
(连接期间出错:获取http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/version:打开//.//pipe/docker_engine:系统找不到指定的文件。 在Windows上的默认守护程序配置中,必须将docker客户端提升运行以进行连接。 该错误也可能表明docker守护程序未运行)
解决办法:
跳转到 docker-machine.exe目录下 cd F:\SoftTool\Docker\docker-machine\v0.16.2
输入命令 docker-machine env VM8
错误提示:
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.10.194:2376": x509: certificate is valid for 192.168.8.110, not 192.168.10.194
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which might stop running containers.
(检查TLS连接时出错:检查和/或重新生成证书时出错:验证主机“ 192.168.10.194:2376”的证书时出错:x509:证书对192.168.8.110有效,而不对192.168.10.194有效
您可以尝试使用“ docker-machine regenerate-certs [name]”来重新生成它们。)
重新生成证书命令: F:\SoftTool\Docker\docker-machine\v0.16.2>docker-machine regenerate-certs VM8
Regenerate TLS machine certs? Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
选择y
正常会 重新生成证书
输入命令 docker version 查看 正常显示