Docker 是一个开源项目,支持以自给自足、可移植的方式构建、测试、部署和管理应用程序容器。它提供了一种将应用程序及其库和其他依赖项打包到用于软件开发的标准化单元中的有效方法。Docker 容器比虚拟机更快、更高效,因为它们不必运行整个操作系统,只需运行为应用程序提供服务的可执行文件。
在 Debian 11 Bullseye 上安装 Docker
步骤 1. 在我们安装任何软件之前,通过apt
在终端中运行以下命令来确保您的系统是最新的很重要:
sudo apt update sudo apt upgrade sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
步骤 2. 在 Debian 11 上安装 Docker。
现在我们将官方 Docker CE 存储库添加到您的系统中:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
添加 Docker CE 存储库后,运行以下命令进行安装:
sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io
使用以下命令验证 Docker 版本的安装:
docker -v
完成后,在您的 Rocky Linux 上启动 Docker 服务,并使其在系统启动时自动运行:
sudo systemctl start docker
sudo systemctl enable docker
为了测试 Docker 安装,我们将运行容器:hello-world
sudo docker run hello-world
输出:
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world b8g0detz29403: Pull complete Digest: sha256:0fe98d7gotof1f85b7c1e8cc81fmoon8d623fcb225gaskeunbec85b38 Status: Downloaded newer image for hello-world:latest 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 contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
感谢您使用本教程在 Debian 11 Bullseye 上安装最新版本的 Docker CE。如需其他帮助或有用信息,我们建议您查看Docker 官方网站。
原创文章,作者:校长,如若转载,请注明出处:https://www.yundongfang.com/Yun3452.html