Docker Desktop简介

汝飞
2023-12-01

Docker Desktop

一、简介

Docker Desktop是可以部署在windows运行docker的应用服务,其基于windos的Hyper-V服务和WSL2内核在windos上创建一个子系统(linux),从而实现其在windows上运行docker。

二、部署

1.开启Hyper-V(自行百度)

2.安装WSL2内核

https://docs.microsoft.com/zh-cn/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package

3.安装docker-compose

https://github.com/docker/compose/releases

三、配置

1.配置镜像加速

{
  "registry-mirrors": [
    "https://hub-mirror.c.163.com",
    "https://1rlt72n0.mirror.aliyuncs.com",
    "https://registry.docker-cn.com",
    "https://mirror.ccs.tencentyun.com",
    "https://mirror.baidubce.com"
  ]
}

2.使用docker-compose管理常用的服务

version: '3'
services:
  mysql:
    environment:
      MYSQL_ROOT_HOST: "%"
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: wanchen # 创建新用户
      MYSQL_PASSWORD: wanchen # 新用户的密码
    # restart: always
    container_name: mysql8.0
    image: mysql:v8
    ports:
      - 3306:3306
    command:
      --default-authentication-plugin=mysql_native_password
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_general_ci
    volumes:
      - D:\ku\dockerku\contains\mysql\conf:/etc/mysql/conf.d
      - D:\ku\dockerku\contains\mysql\data:/var/lib/mysql
      
  redis:
    image: redis:v7
    ports:
      - 6379:6379
    # restart: always
    container_name: redis7
    hostname: redis
    volumes:
      - D:\ku\dockerku\contains\redis\data:/data
      - D:\ku\dockerku\contains\redis\conf:/etc/redis/redis.conf
    command:
      --appendonly yes
 类似资料: