System Requirements:
Windows 10 64bit: Pro, Enterprise or Education (Build 15063 or later).
Virtualization is enabled in BIOS. Typically, virtualization is enabled by default. This is different from having Hyper-V enabled. For more detail see Virtualization must be enabled in Troubleshooting.
CPU SLAT-capable feature.
At least 4GB of RAM.
docker 下载 https://download.docker.com/mac/stable/37199/Docker.dmg(mac 版)
控制面板\所有控制面板项\程序和功能\启用或关闭Windows功能\Windows功能 勾选Hyper-V相关选项
重启,进入BIOS,打开Virtualization
教程 get start:https://docs.docker.com/docker-for-windows/
添加国内镜像,个人使用的中科大:https://docker.mirrors.ustc.edu.cn
测试可用性:docker --version,docker run hello-world
跑nginx: docker run --detach --publish 80:80 --name webserver nginx
打开localhost
Docker命令:
docker --version
列出镜像:docker image ls
docker信息:docker info
镜像下载:docker image pull
测试docker:docker run hello-word
所有容器:docker container ls --all
创建并启动容器:docker run --detach --publish 80:80 --name webserver nignx
停止运行的容器:docker container stop webserver
删除已有容器:docker rm beautiful_brown
启动已有容器:docker start webserver
存活的容器:docker ps
进入容器:docker exec -it webserver /bin/bash
退出:exit
查找本地镜像:docker images redis
查找镜像库:docker search redis
启动redis:docker run -p 6379:6379 -v ~/docker/redis/data:/data --name redisServer redis --appendonly yes
docker run \
-p 6379:6379 \ # 端口映射 宿主机:容器
-v /docker/redis/data:/data:rw \ # 映射数据目录 rw 为读写
-v /docker/redis/conf/redis.conf:/etc/redis/redis.conf:ro \ # 挂载配置文件 ro 为readonly
--privileged=true\ # 给与一些权限
--name myredis \ # 给容器起个名字
-d docker.io/redis:latest redis-server /etc/redis/redis.conf # deamon 运行 服务使用指定的配置文件