菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
297
0

Docker安装

原创
05/13 14:22
阅读数 67536

一、win10以下用户推荐下载Docker Toolbox

1.安装docker Toolbox

  安装完成后建议断开本地网络

2.指定docker machine的位置

  a.在Windows的系统环境添加MACHINE_STORAGE_PATH ,指向虚拟机的位置(例如F:\vm\docker)

  b.复制安装目录下boot2docker.iso到虚拟机的位置同级目录cache中,没有该文件夹自己创建(F:\vm\docker\cache)

3.修改start.sh脚本

  找到"${DOCKER_MACHINE}" create
 
      --engine-registry-mirror 指定加速地址
      --virtualbox-disk-size 指定虚机空间大小,单位M
 
     调整为
     "${DOCKER_MACHINE}" create '--engine-registry-mirror=https://8080ka5p.mirror.aliyuncs.com' -d virtualbox --virtualbox-disk-size "100000" $PROXY_ENV "${VM}"

 

 

4.运行Docker QuickStart安装即可

5.镜像加速

docker-machine ssh default
sudo sed -i "s|EXTRA_ARGS='|EXTRA_ARGS='--registry-mirror=https://registry.docker-cn.com |g" /var/lib/boot2docker/profile
exit
docker-machine restart default

6.建议虚机分配至少2cpu、2G内存,在Oracle VM VirtualBox关闭虚机后调整

 

7.验证命令

docker ps

docker-machine ssh default

当类似
docker search mysql

该命令无法执行使,需要调整一下dns
sudo vi /etc/resolv.conf
nameserver  8.8.8.8

 

 

二、win10

1.对于Windows 10 Home的用户

  1.1安装要求

        Windows 10 Home machines must meet the following requirements to install Docker Desktop:

       Install Windows 10, version 1903 or higher.
            Enable the WSL 2 feature on Windows. For detailed instructions, refer to the Microsoft documentation.
            The following hardware prerequisites are required to successfully run WSL 2 on Windows 10 Home:

         64 bit processor with Second Level Address Translation (SLAT)
                4GB system RAM
                BIOS-level hardware virtualization support must be enabled in the BIOS settings. For more information, see Virtualization.

      Download and install the Linux kernel update package.

  1.2客户端安装

    https://docs.docker.com/docker-for-windows/install-windows-home/

  1.3镜像加速

    在系统右下角托盘图标内右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Daemon。编辑窗口内的JSON串,填写下方加速器地址:

{
  "registry-mirrors": ["https://registry.docker-cn.com"]
}

 

2.对于Windows 10 专业版以上的用户

  2.1安装要求

     Windows 10 64-bit: Pro, Enterprise, or Education (Build 15063 or later).
       Hyper-V and Containers Windows features must be enabled.

  2.2客户端安装

    https://docs.docker.com/docker-for-windows/install/

  2.3镜像加速

    在系统右下角托盘图标内右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Daemon。编辑窗口内的JSON串,填写下方加速器地址:

{
  "registry-mirrors": ["https://registry.docker-cn.com"]
}

注意:

Docker for Windows 和 Docker Toolbox互不兼容,如果同时安装两者的话,需要使用hyperv的参数启动。
docker-machine create --engine-registry-mirror=https://8080ka5p.mirror.aliyuncs.com -d hyperv default

Docker for Windows 有两种运行模式,一种运行Windows相关容器,一种运行传统的Linux容器。同一时间只能选择一种模式运行。

运行出现如下错误:
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException: {"message":"driver failed programming external connectivity on endpoint objective_wright (709b2f91ae761c8cfb7c2c1caa99360265da62eb7c20f82de40d4038545c6dfb): Bind for 0.0.0.0:6379 failed: port is already allocated"}
解决办法:
打开oracle虚拟机,重启虚拟机
 
参考文档
 

发表评论

0/200
297 点赞
0 评论
收藏