win10 wsl安装docker

我的wsl之前已经设置的默认登陆进来都是root用户

 

按照阿里云官网上操作安装docker-ce

https://developer.aliyun.com/mirror/docker-ce?spm=a2c6h.13651102.0.0.3e221b117j5OGs

# step 1: 安装必要的一些系统工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 4: 更新并安装Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce

之后运行docker可以看到docker启动成功

# service docker start
* Starting Docker: docker [ OK ]

但是docker images命令还是会报错

# docker images
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

修改/var/run/docker.sock文件权限

# chmod -R 7777 /var/run/docker.sock

重启docker

# service docker start
* Starting Docker: docker [ OK ]

然后重新使用docker images命令, 可以看到成功

# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE

 配置仓库镜像源为阿里源

# vi /etc/docker/daemon.json

{
  "registry-mirrors": ["https://jxus37ad.mirror.aliyuncs.com"]
}

重启docker服务

service docker restart

 

posted @ 2020-08-13 01:15  laoxiaomingming  阅读(277)  评论(0编辑  收藏  举报