如何在 Debian 11 上安装 Docker
admin
2023-07-31 03:09:01
0

Docker 是一个开源项目,支持以自给自足、可移植的方式构建、测试、部署和管理应用程序容器。它提供了一种将应用程序及其库和其他依赖项打包到用于软件开发的标准化单元中的有效方法。Docker 容器比虚拟机更快、更高效,因为它们不必运行整个操作系统,只需运行为应用程序提供服务的可执行文件。Docker-logoDocker-logo

在 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 官方网站。

相关内容

热门资讯

Windows 11 和 10... Windows 11/10 文件夹属性中缺少共享选项卡 – 已修复 1.检查共享选项卡是否可用 右键...
Radmin VPN Wind... Radmin VPN 是一款免费且用户友好的软件,旨在牢固地连接计算机以创建一个有凝聚力的虚拟专用网...
如何修复 Steam 内容文件... Steam 内容文件锁定是当您的 Steam 文件无法自行更新时出现的错误。解决此问题的最有效方法之...
事件 ID 7034:如何通过... 点击进入:ChatGPT工具插件导航大全 服务控制管理器 (SCM) 负责管理系统上运行的服务的活动...
Hive OS LOLMine... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
在 Windows 11 中打... 什么是链路状态电源管理? 您可以在系统控制面板的电源选项中看到链接状态电源管理。它是 PCI Exp...
如何在 iPhone 14 P... Apple 的 iPhone 14 Pro 是第一款配备 48MP 传感器的 iPhone。所有以前...
如何在电报Telegram中隐... 点击进入:ChatGPT工具插件导航大全 在Android上的电报中隐藏您的电话号码 您可以通过切换...
在 iCloud 上关闭“查找... 如果您是 Apple 的长期用户,您肯定会遇到过 Find My 应用程序,它本机安装在 iPhon...
Hive OS 部署 PXE ... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...