linuxmx安装docker
时间: 2024-11-14 09:16:08 浏览: 10
在Linux系统上安装Docker通常分为几个步骤,特别是对于基于Debian的发行版如Ubuntu,因为它们的软件包管理器apt使其过程相对简单。以下是安装Docker on Ubuntu的基本步骤:
1. **更新包列表**:
```sh
sudo apt update
```
2. **添加Docker GPG key**:
```
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
```
3. **添加官方仓库**:
```sh
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
4. **安装Docker客户端**:
```sh
sudo apt install docker-ce docker-ce-cli containerd.io
```
5. **启动并启用Docker服务**:
```sh
sudo systemctl start docker
sudo systemctl enable docker
```
6. **验证安装**:
运行以下命令检查Docker是否已成功安装:
```sh
docker run hello-world
```
阅读全文