本文共 4618 字,大约阅读时间需要 15 分钟。
下载安装包:
安装完成后桌面会生成三个快捷方式,分别为: (1) Docker Quickstart Terminal: 提供Docker的命令行操作 (2) Oracle VM VirtualBox: 虚拟机软件。 (3) Kitematic (Alpha):图形化的docker工具(镜像boot2docker.iso在virtualbox上安装和启动 -----> ip分配 ----> 文件拷贝到本地)
可能出现以下错误:unable to get the local Boot2Docker ISO version:Did not find prefix "-v" in version string ,start download .....====频繁出现这种提示: 查看当前用户路径下 C:\Users\用户名xx\.docker\machine\machines\是否已经存在default这个目录, 若存在则删除,等待安装成功的docker鲸鱼logo出现
(镜像boot2docker.iso在virtualbox上安装和启动 -----> ip分配 ----> 文件拷贝到本地)
1, 使用iso文件: 创建virtualbox 虚拟机# docker-machine.exe create --engine-registry-mirror=https://XXXXXX(换上你的阿里云专属镜像).mirror.aliyuncs.com --driver virtualbox --virtualbox-boot2docker-url=boot2docker.iso docker1PS C:\Users\jibin\.docker\machine> docker-machine.exe create --driver virtualbox --virtualbox-boot2docker-url=boot2docker.iso存放路径 生成的docker镜像名称Running pre-create checks...(docker) Boot2Docker URL was explicitly set to ".\\cache\\boot2docker.iso" at create time, so Docker Machine cannot upgrade this machine to the latest version.Creating machine...(docker) Boot2Docker URL was explicitly set to ".\\cache\\boot2docker.iso" at create time, so Docker Machine cannot upgrade this machine to the latest version.(docker) Downloading C:\Users\jibin\.docker\machine\cache\boot2docker.iso from .\cache\boot2docker.iso...(docker) Creating VirtualBox VM...(docker) Creating SSH key...(docker) Starting the VM...(docker) Check network to re-create if needed...(docker) Windows might ask for the permission to create a network adapter. Sometimes, such confirmation window is minimized in the taskbar.(docker) Found a new host-only adapter: "VirtualBox Host-Only Ethernet Adapter #2"(docker) Windows might ask for the permission to configure a network adapter. Sometimes, such confirmation window is minimized in the taskbar.(docker) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.(docker) Waiting for an IP...Waiting for machine to be running, this may take a few minutes...Detecting operating system of created instance...Waiting for SSH to be available...Detecting the provisioner...Provisioning with boot2docker...Copying certs to the local machine directory...Copying certs to the remote machine...Setting Docker configuration on the remote daemon...Checking connection to Docker...Docker is up and running!To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: F:\docker\Docker Toolbox\docker-machine.exe env dockerPS C:\Users\jibin\.docker\machine> docker pserror during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/containers/json: open //./pipe/docker_engine: Thesystem 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.2, 配置docker环境vated to connect. This error may also indicate that the docker daemon is not running.PS C:\Users\jibin\.docker\machine> docker-machine.exe env docker$Env:DOCKER_TLS_VERIFY = "1"$Env:DOCKER_HOST = "tcp://192.168.99.100:2376"$Env:DOCKER_CERT_PATH = "C:\Users\jibin\.docker\machine\machines\docker"$Env:DOCKER_MACHINE_NAME = "docker"$Env:COMPOSE_CONVERT_WINDOWS_PATHS = "true"# Run this command to configure your shell:# & "F:\docker\Docker Toolbox\docker-machine.exe" env docker | Invoke-ExpressionPS C:\Users\jibin\.docker\machine> docker-machine.exe env docker |Invoke-ExpressionRun 'docker COMMAND --help' for more information on a command.PS C:\Users\jibin\.docker\machine> docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE
找到docker容器的配置文件: 如default容器
C:\Users\用户名xx.docker\machine\machines\default\config.jsonC:\Users\用户xxx\.docker\machine\machines\docker0\config.json"ConfigVersion": 3, "Driver": { "IPAddress": "192.168.99.100", "MachineName": "docker0", "SSHUser": "docker", "SSHPort": 61640,
找出该虚拟机的ip, 使用ssh工具连接[ 用户名: docker , 密码:tcuser ],输入命令如下:
sudo tee /etc/docker/daemon.json <
回到windows powershell:
docker-machine.exe restart defaultdocker-machine.exe env dockerdocker-machine.exe env docker |Invoke-Expression#验证是否ok: 查看末尾是否有一条阿里云的registry网址docker info
转载地址:http://stdef.baihongyu.com/