docker-ce 安装

  • 配置源
  • 确认版本
  • 添加镜像加速器

https://docs.docker.com/engine/release-notes/19.03/

for centos7

# wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo --no-check-certificate
# yum list docker-ce docker-ce-cli --showduplicates
# yum -y intall docker-ce
# yum -y install docker-ce-3:19.03.15-3.el7 docker-ce-cli-1:19.03.15-3.el7
# yum -y install docker-ce-19.03.15-3.el7 docker-ce-cli-19.03.15-3.el7
yum install docker-ce-24.0.2-1.el7 docker-ce-cli-24.0.2-1.el7
# https://releases.rancher.com/install-docker/20.10.sh

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": [
  "http://hub-mirror.c.163.com",
  "https://0nth4654.mirror.aliyuncs.com",
  "https://docker.mirrors.ustc.edu.cn"]
}
EOF
sudo systemctl daemon-reload
systemctl enable --now docker
docker run hello-world

/etc/docker/deamon.json

for ubuntu18.04

#!/bin/bash
Version=5:19.03.15~3-0~ubuntu-bionic

# step 1: 安装必要的一些系统工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 写入软件源信息,设置稳定版仓库
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

# Step 4: 更新并安装Docker-CE
# apt-cache madison docker-ce
sudo apt-get -y update
sudo apt-get -y install docker-ce=${Version}  docker-ce-cli=${Version}

卸载

yum remove docker \
           docker-client \
           docker-client-latest \
           docker-common \
           docker-latest \
           docker-latest-logrotate \
           docker-logrotate \
           docker-engine

- 版本选择

  • OS系统版本选择:
    Docker 目前已经支持多种操作系统的安装运行,比如Ubuntu、CentOS、Redhat、Debian、Fedora,甚至是还支持了Mac和Windows,在linux系统上需要内核版本在3.10或以上
  • Docker版本选择:
    docker版本号之前一直是0.X版本或1.X版本,但是从2017年3月1号开始改为每个季度发布一次稳定版,其版本号规则也统一变更为YY.MM,例如17.09表示是2017年9月份发布的
    Docker之前没有区分版本,但是2017年推出(将docker更名为)新的项目Moby,github地址: https://github.com/moby/moby
    Moby项目属于Docker项目的全新上游,Docker将是一个隶属于的Moby的子产品,而且之后的版本之后开始区分为 CE(Docker Community Edition,社区版本)和EE(Docker Enterprise Edition,企业收费版),CE社区版本和EE企业版本都是每个季度发布一个新版本,但是EE版本提供后期安全维护1年,而CE版本是4个月

PS:

https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/
https://www.runoob.com/docker/centos-docker-install.html
https://learnku.com/articles/22822

posted @ 2021-05-17 06:53  AlexG  阅读(186)  评论(0编辑  收藏  举报