Docker Desktop 安装及使用

发布时间 2023-03-22 21:15:52作者: 雨水的命运

Docker Desktop需要版权

安装包下载

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

安装

因为docker desktop和镜像默认安装C盘,需要先设置符号链接指向其他盘符
第一个目录需要不存在

--docker安装包
mklink /d /j "C:\Program Files\Docker" "D:\Program Files\Docker"

--docker镜像
mklink /d /j "%UserProfile%\AppData\Local\Docker" "D:\Program Files\Docker\imagedata"

然后双击安装包进行安装,安装完成后会有一个Docker Desktop Service名称的Windows服务

开启wsl2后,配置以%UserProfile%\.wslconfig文件为主

设置界面 Docker Engine 镜像源配置

阿里云的地址记得访问从控制台拷贝,https://cr.console.aliyun.com/不是真正的地址

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "features": {
    "buildkit": true
  },
  "live-restore": true,
  "registry-mirrors": [
    "http://mirrors.tuna.tsinghua.edu.cn",
    "http://mirrors.aliyun.com",
    "https://cr.console.aliyun.com",
    "http://hub-mirror.c.163.com"
  ]
}

安装K8S

必须先配置镜像源确定并重启

  1. 配置镜像源后在主界面Images子界面点击Clean Up清理环境
  2. Docker设置选中Kubernetes界面勾选Enable Kubernetes安装
  3. 等待十几分钟安装完成后,勾选Show system containers (advanced)选项确定并重启
  4. 命令行输入kubectl version确定K8S版本号
  5. 命令行输入kubectl cluster-info,出现绿色Kubernetes control planeCoreDNS的字母,代表安装成功。如果提示Unable to connect to the server: EOF的错误,则需要返回Docker设置Kubernetes界面,点击Reset Kubernetes Cluster重置K8S,再重新输入指令即可
  6. 输入kubectl get nodes查看节点