六、配置docker并使用
1、docker安装完成后,如果不想每次在输入命令前都要加上sudo的话,运行下面的命令
sudo usermod -aG docker $USER && newgrp docker
2、配置国内仓库源或自己的私有仓库源,在/etc/docker/daemon.json文件中添加以下的内容即可。配置完成后需要重启docker的服务sudo systemctl restart docker方可生效。
"registry-mirrors": [
"https://国内可用仓库的域名",
"https://私有仓库的IP:端口"
]

3、配置docker在子系统启动的时候跟着自启动
sudo systemctl enable docker
七、拉取镜像并测试运行容器
拉取一个容量比较小的镜像,测试一下是否可以正常拉取镜像,
sean@vmpc:~$ docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
43c4264eed91: Pull complete
Digest: sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d
Status: Downloaded newer image for alpine:latest
docker.io/library/alpine:latest
sean@vmpc:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
alpine latest 91ef0af61f39 3 weeks ago 7.8MB
利用这个镜像创建一个容器
sean@vmpc:~$ docker run -it --name hello alpine:latest echo "hello world"
hello world
sean@vmpc:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7e1eabd6e985 alpine:latest "echo 'hello world'" 10 seconds ago Exited (0) 7 seconds ago
hello
如果以上都可以正常运行,恭喜你,你已经可以在家庭版的window下面使用docker了。而且是显卡直通的那种。