linux怎么安裝docker

如何在 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.docker.com/linux/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/centos/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.

? 版權聲明
THE END
喜歡就支持一下吧
點贊11 分享