Docker 是一个开源的应用容器引擎,可以打包您的应用以及其依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。以下是如何在您的系统上安装 Docker 的步骤。
安装前的准备
在开始安装 Docker 之前,请确保您的系统满足以下要求:
- 操作系统:支持 Docker 的 Linux 发行版,如 Ubuntu、CentOS 等。
- 系统架构:64 位系统。
- 硬件:足够的磁盘空间和内存。
安装步骤
以下是使用 Docker 官方安装脚本在大多数 Linux 发行版上安装 Docker 的步骤:
- 更新系统包列表:
sudo apt-get update
- 安装依赖包:
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
- 添加 Docker GPG 密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- 设置 Docker 仓库:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- 更新系统包列表:
sudo apt-get update
- 安装 Docker:
sudo apt-get install -y docker-ce
- 启动 Docker 服务:
sudo systemctl start docker
- 验证安装:
sudo docker run hello-world
如果一切顺利,您应该会看到如下输出:
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker daemon was started.
2. The Docker client contacted the Docker daemon.
3. A new container from an image that matches hello-world was created.
4. That container was started.
5. The container executed the command `echo Hello from Docker!`.
6. The container exited with status 0.
参考链接
如果您需要更多关于 Docker 的信息,可以访问以下链接:
希望这份指南能帮助您成功安装 Docker。祝您使用愉快!
Docker Logo