“模板:Docker”的版本间的差异

来自ARM Wiki
跳转至: 导航搜索
配置Ubuntu\Debian软件库
第18行: 第18行:
 
sub  rsa4096 2017-02-22 [S]
 
sub  rsa4096 2017-02-22 [S]
 
</syntaxhighlight>
 
</syntaxhighlight>
*添加Docker源
+
*添加Docker源,[arch=arm64]中的参数根据系统架构决定
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
 
sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

2020年5月15日 (五) 17:01的版本

配置Ubuntu\Debian软件库

  • 更新apt软件包索引并安装软件包
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

选项1:通用源

  • 添加Docker的官方GPG密钥:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
  • 执行完以上命令会有如下提示
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
sub   rsa4096 2017-02-22 [S]
  • 添加Docker源,[arch=arm64]中的参数根据系统架构决定
sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

选项2:国内源

USTC (China)

安装Docker

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

安装特定版本

  • 首先查找当前提供的可用版本
apt-cache madison docker-ce
  • 如下是部分打印信息,第二列为版本信息
 docker-ce | 5:19.03.8~3-0~debian-stretch | https://download.docker.com/linux/debian stretch/stable arm64 Packages
 ...
  • 按如下命令安装(<VERSION_STRING>替换成对应的版本号)
sudo apt install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

示例:

sudo apt install docker-ce=5:19.03.8~3-0~debian-stretch docker-ce-cli=5:19.03.8~3-0~debian-stretch containerd.io

运行容器

docker run -it ubuntu bash
  • 没有本地镜像的情况下会自动pull下来,完成后会进入容器

Docker-demo