windows子系统ubuntu安装docker
Ubuntu 22.04安装docker
访问docker 官网,获取ubuntu安装命令:
1.先删除旧版本
1
| sudo apt-get remove docker docker-engine docker.io containerd runc
|
2.更新 ubuntu 更新数据源列表
3.安装 https 请求库
1 2 3 4 5
| sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release
|
4.添加Docker的官方GPG密钥
1 2
| sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
5.使用以下命令设置存储库
1 2 3 4
| echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
6.安装docker 引擎
1 2
| sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
7. 测试安装docker 是否成功
1
| sudo docker run hello-world
|
报错信息

1
| https://blog.csdn.net/lupengfei1009/article/details/94637398
|
Ubantu 报错:System has not been booted with systemd as init system (PID 1). Can‘t operate.
WSL 中暂时不支持 systemctl,所以使用下面的命令会报错。
报错信息为
System has not been booted with systemd as init system (PID 1). Can’t operate.
Failed to connect to bus: Host is down
使用service
换wsl2
