主要參考: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:”,须要输入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:Usersyumin.pym.boot2docker文件夹下;当中的yumin.pym是username;
假设提示无法rename。则须要关闭VirtualBox中正在运行的虚拟机boot2docker-vm。
【4】启动容器时无法运行/bin/bash
如上图所看到的。双斜杠解决;
详见:http://stackoverflow.com/questions/30132231/boot2docker-windows-cant-run-bash-on-ubuntu-container
【5】登录boot2docker
boot2docker ssh
默认username:docker,password: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:Usersyumin.pym.boot2dockercertsoot2docker-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
注意:=两边不要加空格,这个问题查了两个小时;