Docker 是一个开源的应用容器引擎,可以打包您的应用以及其依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。以下是安装 Docker 的步骤:
安装步骤
更新系统包列表
打开终端,执行以下命令:sudo apt-get update
安装依赖
在大多数情况下,Docker 需要以下依赖:sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
添加 Docker 仓库
添加 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"
安装 Docker
更新包列表并安装 Docker:sudo apt-get update sudo apt-get install -y docker-ce
启动 Docker
启动 Docker 服务:sudo systemctl start docker
验证安装
尝试运行 hello-world 容器:docker run hello-world
如果一切顺利,您将看到以下输出:
Hello from Docker! This message shows that your installation appears to be working correctly.
相关链接
更多关于 Docker 的信息,您可以访问 Docker 官方网站。
Docker Logo