当前位置:   article > 正文

Centos7及Ubuntu系统安装指定版本docker&docker-compose安装_apt-get安装指定版本 docker-compose

apt-get安装指定版本 docker-compose

Centos7系统 docker指定版本安装【官方文档步骤】

官方文档地址:https://docs.docker.com/engine/install/centos/

# 1.安装yum工具及设置docker-ce镜像库
sudo yum install -y yum-utils

# 国外的镜像下载太慢了改成阿里云镜像库
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

# 2.阿里云镜像库
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

# 3.查询docker可用稳定版本
yum list docker-ce --showduplicates | sort -r

[root@localhost ~]# yum list docker-ce --showduplicates | sort -r
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror, langpacks
Installed Packages
docker-ce.x86_64            3:24.0.6-1.el7                     docker-ce-stable 
docker-ce.x86_64            3:24.0.6-1.el7                     @docker-ce-stable
docker-ce.x86_64            3:24.0.5-1.el7                     docker-ce-stable 
docker-ce.x86_64            3:24.0.4-1.el7                     docker-ce-stable 
docker-ce.x86_64            3:24.0.3-1.el7                     docker-ce-stable 
docker-ce.x86_64            3:24.0.2-1.el7                     docker-ce-stable 
docker-ce.x86_64            3:24.0.1-1.el7                     docker-ce-stable 
docker-ce.x86_64            3:24.0.0-1.el7                     docker-ce-stable 
docker-ce.x86_64            3:23.0.6-1.el7                     docker-ce-stable 
docker-ce.x86_64            3:23.0.5-1.el7                     docker-ce-stable 
docker-ce.x86_64            3:23.0.4-1.el7                     docker-ce-stable 



# 4.安装指定版本<24.0.6>版本
yum install docker-ce-24.0.6 -y

# 5.添加开机启动docker服务及运行启动docker服务
systemctl enable docker
systemctl start docker
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

Ubuntu20.04系统 docker指定版本安装

# 1.移除旧版docker
sudo apt-get remove docker docker-engine docker.io containerd runc

# 2.更新包索引
sudo apt-get update

# 3.安装依赖库
sudo apt-get install\
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

# 4.添加 Docker 的官方 GPG 密钥    
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

# 5.设置稳定版仓库
sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu/ \
  $(lsb_release -cs) \
  stable"

# 6.查看可用版本
sudo apt-cache madison docker-ce

dev@localhost:~$ sudo apt-cache madison docker-ce
 docker-ce | 5:24.0.7-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:24.0.6-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:24.0.5-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:24.0.4-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:24.0.3-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:24.0.2-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:24.0.1-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:24.0.0-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:23.0.6-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:23.0.5-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:23.0.4-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:23.0.3-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:23.0.2-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:23.0.1-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:23.0.0-1~ubuntu.20.04~focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.24~3-0~ubuntu-focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.23~3-0~ubuntu-focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.22~3-0~ubuntu-focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.21~3-0~ubuntu-focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.20~3-0~ubuntu-focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.19~3-0~ubuntu-focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.18~3-0~ubuntu-focal | https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages

# 7.安装docker 20.10版本
sudo apt-get install docker-ce=5:20.10.22~3-0~ubuntu-focal docker-ce-cli=5:20.10.22~3-0~ubuntu-focal containerd.io

# 8.配置普通用户使用docker免去sudo

sudo usermod -aG docker dev
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56

docker-compose安装

#!/bin/bash

sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

chmod u+x /usr/local/bin/docker-compose

docker-compose --version

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/477255
推荐阅读
相关标签
  

闽ICP备14008679号