Docker 是一个开源的应用容器引擎,可以打包、发布和运行应用。本教程将指导您在 CentOS 系统上安装 Docker。
安装 Docker
更新系统
首先更新您的系统,以便安装 Docker:sudo yum update -y
安装 Docker
安装 Docker 的 yum 仓库:sudo yum install -y yum-utils sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
然后安装 Docker:
sudo yum install -y docker-ce docker-ce-cli containerd.io
启动 Docker
启动 Docker 服务:sudo systemctl start docker
验证安装
运行一个简单的容器来验证 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 client executed the 'docker run hello-world' command. 2. The Docker daemon received the request from the client and forwarded it to the container runtime. 3. The container runtime pulled the "hello-world" image from the Docker Hub. 4. The container runtime created a new container from that image which runs the 'hello-world' program. 5. The program finished and exited, and the container was removed.
学习更多
要深入了解 Docker,您可以访问 Docker 官方文档。
[
如果您想要更深入地了解 Docker 的使用和配置,可以阅读我们的另一篇教程:Docker 高级教程。