主要参考:http://docs.docker.com/installation/windows/
【1】安装完成后允许后可能会报错:
error in run: Failed to start machine “boot2docker-vm”(run again with -v for detail)
solution:
出现上述错误,多是因为硬件的虚拟化功能没有开启所致;
启动按F1/Delete键进入BIOS,【Security】->【Virtualization】->【Intel (R) Virtualization Technology】->【Enabled】
【2】提示”docker@localhost’s password:”,需要输入密码,依次执行如下命令即可解决问题。

boot2docker delete
boot2docker init
boot2docker start

安装完成以后,可以执行:

docker run hello-world

第一次执行,会下载镜像并显示Hello from Docker.
这里写图片描述
第二次执行直接展示示Hello from Docker.
至此说明docker安装成功.
【3】Error response from daemon: client and server don’t have same version (client : 1.19, server: 1.15)

$ boot2docker stop
$ boot2docker download
$ boot2docker up

注意:$ boot2docker download如果如下报错,用如下指令替换,其中v1.7.0是版本号,可以替换成最新版;
这里写图片描述

boot2docker.exe --iso-url=https://github.com/boot2docker/boot2docker/releases/download/v1.7.0/boot2docker.iso download

此外还可以直接下载boot2docker.iso然后放置在C:\Users\yumin.pym.boot2docker目录下;其中的yumin.pym是用户名;
如果提示无法rename,则需要关闭VirtualBox中正在运行的虚拟机boot2docker-vm;
【4】启动容器时无法执行/bin/bash
这里写图片描述
如上图所示,双斜杠解决;
详见:http://stackoverflow.com/questions/30132231/boot2docker-windows-cant-run-bash-on-ubuntu-container
【5】登录boot2docker
boot2docker ssh
这里写图片描述
默认用户名:docker,密码:tcuser
【6】创建支持SSH服务的镜像

docker exec -ti 24 //bin/bash
ifconfig #获取ip 172.17.0.54

回到宿主机,SSH登录方式1:

ssh root@172.17.0.54

登录方式2:

ssh root@127.0.0.1 -p 10022

【7】An error occurred trying to connect: Get https://192.168.59.104:2376/v1.19/version: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.104

$boot2docker delete
$boot2docker init
$boot2docker up
To connect the Docker client to the Docker daemon, please set:
    export DOCKER_CERT_PATH='C:\Users\yumin.pym\.boot2docker\certs\boot2docker-vm'
    export DOCKER_TLS_VERIFY=1
    export DOCKER_HOST=tcp://192.168.59.108:2376
$export DOCKER_HOST=tcp://192.168.59.108:2376

【8】dockerpool CA证书错误

sudo docker pull dl.dockerpool.com:5000/ubuntu
FATA[0000] Error response from daemon: v1 ping attempt failed with error: Get https://dl.dockerpool.com:5000/v1/_ping: tls: oversized record received with length 28012. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add --insecure-registry dl.dockerpool.com:5000 to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/dl.dockerpool.com:5000/ca.crt

解决方法:
在/var/lib/boot2docker/profile中增加如下内容,如果没有这个文件,则新建这个文件;

EXTRA_ARGS="--insecure-registry dl.dockerpool.com:5000"

然后执行如下命令:

$ boot2docker init
$ boot2docker up
$ boot2docker ssh "echo $'EXTRA_ARGS=\"--insecure-registry <YOUR INSECURE HOST>\"' | sudo tee -a /var/lib/boot2docker/profile && sudo /etc/init.d/docker restart"

参考:https://github.com/boot2docker/boot2docker#insecure-registry
注意:=两边不要加空格,这个问题查了两个小时;

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐