linux怎么安装docker

如何在 linux 上安装 docker?步骤如下:检查先决条件:内核版本 3.10+、ram ≥ 2gb、稳定网络。安装依赖项:ubuntu/debian:apt-get install apt-transport-https…;ce

如何在 linux 上安装 docker?步骤如下:检查先决条件:内核版本 3.10+、ram ≥ 2gb、稳定网络。安装依赖项:ubuntu/debian:apt-get install apt-transport-https…;centos/red hat:yum install yum-utils…添加 docker 官方仓库:ubuntu/debian:curl… | apt-key add -;centos/red hat:yum-config-manager –add-

linux怎么安装docker

如何在 Linux 上安装 Docker

第一步:检查先决条件

  • Linux 内核版本 3.10 或更高版本
  • 至少 2GB 的 RAM
  • 稳定的互联网连接

第二步:安装 Docker 依赖项

  • Ubuntu/Debian:

    sudo apt-get update
    sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

    登录后复制

  • CentOS/Red Hat:

    sudo yum install -y yum-utils device-mapper-persistent-data lvm2

    登录后复制

第三步:添加 Docker 官方仓库

  • Ubuntu/Debian:

    sudo curl -fsSL https://download.<a style="color:#f60; text-decoration:underline;" href="https://www.php.cn/zt/15865.html" target="_blank">docker</a>.com/<a style="color:#f60; text-decoration:underline;" href="https://www.php.cn/zt/15718.html" target="_blank">linux</a>/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

    登录后复制

  • CentOS/Red Hat:

    sudo yum-config-manager --add-repo https://download.docker.com/linux/<a style="color:#f60; text-decoration:underline;" href="https://www.php.cn/zt/15739.html" target="_blank">centos</a>/docker-ce.repo

    登录后复制

第四步:安装 Docker

  • Ubuntu/Debian:

    sudo apt-get update
    sudo apt-get install docker-ce

    登录后复制

  • CentOS/Red Hat:

    sudo yum install docker-ce

    登录后复制

第五步:启动 Docker

  • Ubuntu/Debian:

    sudo systemctl start docker

    登录后复制登录后复制

  • CentOS/Red Hat:

    sudo systemctl start docker

    登录后复制登录后复制

第六步:验证安装

运行以下命令检查 Docker 是否已成功安装:

docker run hello-world

登录后复制

如果看到类似于以下内容的输出,则表示 Docker 已成功安装:

Hello from Docker!
This message shows that your installation appears to be working correctly.

登录后复制

以上就是linux怎么安装docker的详细内容,更多请关注叮当号网其它相关文章!

文章来自互联网,只做分享使用。发布者:走不完的路,转转请注明出处:https://www.dingdanghao.com/article/564065.html

(0)
上一篇 2024-06-03 12:00
下一篇 2024-06-03 12:40

相关推荐

联系我们

在线咨询: QQ交谈

邮件:442814395@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信公众号