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
# 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

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://0nth4654.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
systemctl enable --now docker

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://www.runoob.com/docker/centos-docker-install.html
https://learnku.com/articles/22822

原文地址:https://www.cnblogs.com/firewalld/p/14685880.html