Docker安装

Docker可用于免费社区版(CE)和企业版(EE)中的订阅,可以安装在裸机或云基础架构上。

#特点和优点
    在裸机服务器和虚拟机上轻松安装和设置用于CentOS分发的优化Docker环境。
    最新的Docker平台版本,内置业务流程(集群和调度),运行时安全性,容器网络和卷
    Docker CE可以作为免费下载,每月一次的Edge或季度稳定发布与社区支持。
    Docker EE订阅包括每个版本一年维护的季度发布和使用SLA的企业级支持。

debian9 安装docker-ce

## 前提是apt基础源已调整可用,请参考apt源那边文章
    # 安装基础软件包、卸载垃圾软件包
    apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common

    # 添加docker的GPG公钥
    curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
    # curl -fsSL https://mirrors.huaweicloud.com/docker-ce/linux/debian/gpg | sudo apt-key add -

    # 添加docker软件源
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
    # add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable"
    # 对于树莓派或其它Arm架构计算机,请运行:
    # add-apt-repository "deb [arch=armhf] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

    # 安装docker程序包
    apt-get update -y
    apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
    # 启动
    systemctl enable --now docker

debian10 安装 docker-ce

    apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
    curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
    apt update
    apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

ubuntu安装docker-ce

#ubuntu 14.04默认使用AUFS作为Docker CE的存储层驱动,需要安装可选内核,
#ubuntu 16.04默认使用overlay2作为Docker CE的存储层驱动,无需特殊配置
    apt install linux-image-extra-$(uname -r)  linux-image-extra-virtual

#由于 apt 源使用 HTTPS 以确保软件下载过程中不被篡改。因此,我们首先需要添加使用HTTPS 传输的软件包以及 CA 证书。

sudo apt update
sudo apt install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

#鉴于国内网络问题,强烈建议使用国内源,官方源请在注释中查看。为了确认所下载软件包的合法性,需要添加软件源的 GPG 密钥

    curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
    # 官方源
    #curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

#然后,我们需要向 source.list 中添加 Docker 软件源

    sudo add-apt-repository \
    "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

    # 或者arm64
    sudo add-apt-repository \
    "deb [arch=arm64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

    # 官方源
    #  sudo add-apt-repository \
    # "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    # $(lsb_release -cs) \
    # stable

#更新 apt 软件包缓存,并安装 docker-ce
    sudo apt update
    sudo apt install docker-ce
    sudo systemctl start docker
    sudo systemctl enable docker

#之后重启启动系统
    sudo systemctl daemon-reload
    sudo systemctl restart docker

#验证docker是否安装成功
    docker version 

CentOS安装docker

#设置yum源
    sudo yum install -y yum-utils
    #sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    sudo yum makecache fast

#安装docker,并启动容器
    sudo yum -y install docker-ce
    sudo systemctl enable --now docker

#执行docker info查看安装信息,测试Docker CE安装
    docker info
    sudo docker run hello-world

RockyLinux系列安装docker-ce


    dnf config-manager --add-repo=http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    dnf -y install docker-ce
    systemctl enable --now docker

基于debian 12 的armbian 如何安装docker (方法不区分 x86 和 arm64)

# 改源
    cat > /etc/apt/sources.list << EOF
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib 
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib 
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib 
EOF

# 安装必要软件、添加信任key
    apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
    curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

    # 添加阿里云的docker源
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    apt update
    apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
声明:本文为原创,作者为 辣条①号,转载时请保留本声明及附带文章链接:https://boke.wsfnk.com/archives/262.html
谢谢你请我吃辣条谢谢你请我吃辣条

如果文章对你有帮助,欢迎点击上方按钮打赏作者

最后编辑于:2025/5/4作者: 辣条①号

目标:网络规划设计师、系统工程师、ceph存储工程师、云计算工程师。 不负遇见,不谈亏欠!

暂无评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

arrow grin ! ? cool roll eek evil razz mrgreen smile oops lol mad twisted wink idea cry shock neutral sad ???

文章目录