树莓派安装docker遭遇的问题

本文记录了在树莓派上安装Docker时遇到的三个问题:1) apt-get update报错仓库过期,通过调整系统时间解决;2) 源更新速度慢,更换为清华大学镜像源;3) curl命令无法解析主机,通过修改DNS解决。最终成功安装Docker。
摘要由CSDN通过智能技术生成

树莓派安装docker遭遇的问题

 最近学习树莓派,结合docker的方便,便想在树莓派上安装docker,之前在ubuntu搭建过,这次在raspbian系统上搭建;
 参考这篇文章,记录下遇到的一些问题.

问题一

apt-get update报错仓库过期

 树莓派不自带计时时钟,除非开机自动同步网络事件,否则重启后时间停在关机的那一刻;
 报错如下:

root@raspberrypi:/home/pi# sudo apt-get update
命中:1 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian buster InRelease
获取:2 http://mirrors.tuna.tsinghua.edu.cn/raspberrypi buster InRelease [32.6 kB]
命中:3 https://download.docker.com/linux/raspbian buster InRelease                  
正在读取软件包列表... 完成
E: http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/dists/buster/InRelease 的 Release 文件已经过期(已经过期了 20小时 4252)。该仓库的更新将不会应用。
E: http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/dists/buster/InRelease 的 Release 文件已经过期(已经过期了 14小时 5141)。该仓库的更新将不会应用。

 更新时间为当前时间,假设当前时间为2021年7月28日12点半,则执行以下命令:

root@raspberrypi:/home/pi# date -s "20210728 12:30"
2021年 07月 28日 星期三 12:30:00 CST

问题二

apt-get update可能执行太慢

 树莓派刚使用时可能采用的源速度比较慢,需要更改源,我的如下:

root@raspberrypi:/home/pi# cat /etc/apt/sources.list
# deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib

 下面这个源不太清楚,参考其他blog改的.

root@raspberrypi:/home/pi# cat /etc/apt/sources.list.d/raspi.list 
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

问题三

curl报错不能解析
root@raspberrypi:/home/pi# curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add -
curl: (6) Could not resolve host: yum.dockerproject.org
gpg: 找不到有效的 OpenPGP 数据。

 尝试修改/etc/resolv.conf文件为以下内容:

root@raspberrypi:/home/pi# cat /etc/resolv.conf
# Generated by resolvconf
nameserver 114.114.114.114
nameserver 8.8.8.8

 由于对网络配置这块了解不深,采用第二种方法,问题待解决…

 最后按照第一种方法,直接一条命令解决:

root@raspberrypi:/home/pi# sudo curl -sSL https://get.docker.com | sh
# Executing docker install script, commit: 7cae5f8b0decc17d6571f9f52eb840fbc13b2737
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/raspbian/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sh -c echo "deb [arch=armhf] https://download.docker.com/linux/raspbian buster stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ [ -n  ]
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
 + [ -n 1 ]
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce-rootless-extras >/dev/null
+ sh -c docker version
略...


2021-7-28 更新


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值