博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
docker系列2: windows安装docker
阅读量:2110 次
发布时间:2019-04-29

本文共 4618 字,大约阅读时间需要 15 分钟。

1,使用DockerToolbox.exe安装

下载安装包:

安装完成后桌面会生成三个快捷方式,分别为:
(1) Docker Quickstart Terminal: 提供Docker的命令行操作
(2) Oracle VM VirtualBox: 虚拟机软件。
(3) Kitematic (Alpha):图形化的docker工具

点击Docker Quickstart Terminal快捷方式,开始配置docker在virtualbox的镜像

(镜像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出现

2, 使用docker-machine.exe 命令行安装

下载所需的原始镜像 boot2docker.iso:

(镜像boot2docker.iso在virtualbox上安装和启动 -----> ip分配 ----> 文件拷贝到本地)

  • 1, docker-machine.exe create --driver virtualbox --virtualbox-boot2docker-url=boot2docker.iso存放路径 生成的docker镜像名称
  • 2, docker-machine.exe env docker
  • 3, docker-machine.exe env docker |Invoke-Expression
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

3, 配置阿里镜像加速

找到docker容器的配置文件: 如default容器

C:\Users\用户名xx.docker\machine\machines\default\config.json

C:\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/

你可能感兴趣的文章
【托业】【新东方托业全真模拟】TEST07~08-----P5~6
查看>>
solver及其配置
查看>>
JAVA多线程之volatile 与 synchronized 的比较
查看>>
Java集合框架知识梳理
查看>>
笔试题(一)—— java基础
查看>>
Redis学习笔记(二)— 在linux下搭建redis服务器
查看>>
Redis学习笔记(三)—— 使用redis客户端连接windows和linux下的redis并解决无法连接redis的问题
查看>>
Intellij IDEA使用(一)—— 安装Intellij IDEA(ideaIU-2017.2.3)并完成Intellij IDEA的简单配置
查看>>
Intellij IDEA使用(二)—— 在Intellij IDEA中配置JDK(SDK)
查看>>
Intellij IDEA使用(三)——在Intellij IDEA中配置Tomcat服务器
查看>>
Intellij IDEA使用(四)—— 使用Intellij IDEA创建静态的web(HTML)项目
查看>>
Intellij IDEA使用(五)—— Intellij IDEA在使用中的一些其他常用功能或常用配置收集
查看>>
Intellij IDEA使用(六)—— 使用Intellij IDEA创建Java项目并配置jar包
查看>>
Eclipse使用(十)—— 使用Eclipse创建简单的Maven Java项目
查看>>
Eclipse使用(十一)—— 使用Eclipse创建简单的Maven JavaWeb项目
查看>>
Intellij IDEA使用(十三)—— 在Intellij IDEA中配置Maven
查看>>
面试题 —— 关于main方法的十个面试题
查看>>
集成测试(一)—— 使用PHP页面请求Spring项目的Java接口数据
查看>>
使用Maven构建的简单的单模块SSM项目
查看>>
Intellij IDEA使用(十四)—— 在IDEA中创建包(package)的问题
查看>>