document/文档/linux/docker/docker.md
2024-06-30 17:50:13 +08:00

23 lines
875 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Docker
## 安装
```sh
# 更新系统包列表:
sudo apt update
# 安装依赖包:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
# 添加 Docker 的官方 GPG 密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# 添加 Docker APT 仓库:
echo "deb [arch=$(dpkg --print-architecture) 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
# 更新包列表:
sudo apt update
# 安装 Docker CE社区版
sudo apt install docker-ce
# 启动 Docker 并设置为开机启动:
sudo systemctl start docker
sudo systemctl enable docker
# 验证 Docker 是否安装成功:
sudo docker run hello-world
```