wsl ubuntu20.4 安装docker

docker 网站被禁处理办法

sudo curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
 
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

docker 安装命令

sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

查看服务管理方式

ps -p 1 -o comm=

启动服务

sudo /ect/init.d/docker start 

授权非root

// 暂时的
sudo chmod /var/run/docker.sock

// 当前用户假如docker用户组
sudo usermod -aG docker $USER

// 更新用户组
newgrp docker  

同理镜像被墙了

// 打开文件
sudo vim /etc/docker/daemon.json

// 写入镜像
{
    "registry-mirrors": [
        "https://ustc-edu-cn.mirror.aliyuncs.com/",
        "https://ccr.ccs.tencentyun.com/",
        "https://docker.m.daocloud.io/"
    ]
}

// 验证
docker container run hello-world


桌面版本 win

https://mirrors.aliyun.com/docker-toolbox/windows/docker-for-windows/stable/Docker Desktop Installer.exe
posted @ 2024-08-01 15:33  vx_guanchaoguo0  阅读(12)  评论(0编辑  收藏  举报