文章目录
Docker可用于免费社区版(CE)和企业版(EE)中的订阅,可以安装在裸机或云基础架构上。
#特点和优点
在裸机服务器和虚拟机上轻松安装和设置用于CentOS分发的优化Docker环境。
最新的Docker平台版本,内置业务流程(集群和调度),运行时安全性,容器网络和卷
Docker CE可以作为免费下载,每月一次的Edge或季度稳定发布与社区支持。
Docker EE订阅包括每个版本一年维护的季度发布和使用SLA的企业级支持。
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 软件源
add-apt-repository \
"deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
$(lsb_release -cs) \
stable"
# 或者arm64
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
apt update
apt install docker-ce
systemctl start docker
systemctl enable docker
#之后重启启动系统
sudo systemctl daemon-reload
sudo systemctl restart docker
#验证docker是否安装成功
docker version
CentOS安装docker
#设置yum源
yum install -y yum-utils
#sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
#安装docker,并启动容器
yum -y install docker-ce
systemctl enable --now docker
#执行docker info查看安装信息,测试Docker CE安装
docker info
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 9、10、11、12 以及 基于debian 的armbian 如何安装docker (适用于 x86、arm64,不区分架构,内置命令会自动识别)
# 确保软件源可用
# 安装必要软件、添加信任key
apt update
apt install -y apt-transport-https ca-certificates curl gnupg gnupg2 lsb-release
# 添加信任key
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
# curl -fsSL https://mirrors.huaweicloud.com/docker-ce/linux/debian/gpg | apt-key add -
# 添加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" | tee /etc/apt/sources.list.d/docker.list > /dev/null
# echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
# add-apt-repository "deb [arch=$(dpkg --print-architecture) https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
# debian 9 系列 仓库没有 docker-compose-plugin 该包,且 docker 版本为 Version: 19.03.15
apt install -y docker-ce docker-ce-cli containerd.io
# debian 10、11、12
apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
如果文章对你有帮助,欢迎点击上方按钮打赏作者
暂无评论