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: rootMYSQL_USER: wanchen # 创建新用户MYSQL_PASSWORD: wanchen # 新用户的密码# restart: alwayscontainer_name: mysql8.0image: mysql:v8ports:- 3306:3306command:--default-authentication-plugin=mysql_native_password--character-set-server=utf8mb4--collation-server=utf8mb4_general_civolumes:- D:\ku\dockerku\contains\mysql\conf:/etc/mysql/conf.d- D:\ku\dockerku\contains\mysql\data:/var/lib/mysqlredis:image: redis:v7ports:- 6379:6379# restart: alwayscontainer_name: redis7hostname: redisvolumes:- D:\ku\dockerku\contains\redis\data:/data- D:\ku\dockerku\contains\redis\conf:/etc/redis/redis.confcommand:--appendonly yes