本文共 5650 字,大约阅读时间需要 18 分钟。
tags: 网站
硬件平台:Sail - i.max6Q 工业级开发板。(感谢电鱼公司无偿赞助开发板。公司主页:。)
操作系统: ubuntu 14.04(armhf)
apt-get install curl wget apt-transport-https ca-certificates
备份原sources.list
文件
# 备份原文件cp /etc/apt/sources.list /etc/apt/sources.list.bak
新建sources.list
# 新建文件vi /etc/apt/sources.list
粘贴中科大Ubuntu armhf 源内容(Ubuntu 14.04 trusty)
中科大Ubuntu 14.04 trusty armhf 软件源(推荐https)
# 默认注释了源码仓库,如有需要可自行取消注释deb https://mirrors.ustc.edu.cn/ubuntu-ports/ trusty main restricted universe multiverse# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ trusty main main restricted universe multiversedeb https://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-updates main restricted universe multiverse# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-updates main restricted universe multiversedeb https://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-backports main restricted universe multiverse# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-backports main restricted universe multiversedeb https://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-security main restricted universe multiverse# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-security main restricted universe multiverse# 预发布软件源,不建议启用# deb https://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-proposed main restricted universe multiverse# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-proposed main restricted universe multiverse
中科大Ubuntu 14.04 trusty armhf 软件源(http备选方案)
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty main multiverse restricted universedeb http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-backports main multiverse restricted universedeb http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-proposed main multiverse restricted universedeb http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-security main multiverse restricted universedeb http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-updates main multiverse restricted universedeb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty main multiverse restricted universedeb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-backports main multiverse restricted universedeb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-proposed main multiverse restricted universedeb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-security main multiverse restricted universedeb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty-updates main multiverse restricted universe
# 下载证书 cacert.pem# 网址: https://curl.haxx.se/docs/caextract.htmlwget https://curl.haxx.se/ca/cacert.pem --no-check-certificate# 导入证书# 转换为crt格式openssl x509 -outform der -in cacert.pem -out cacert.crt# 复制到证书目录sudo cp cacert.crt /usr/local/share/ca-certificates/cacert.crt# 添加证书到系统sudo update-ca-certificates# 重启系统或重启特定服务使新证书生效reboot
重启后 验证证书是否生效
# 访问https网站查看是否报证书错误curl https://wanghualong.cncurl https://www.docker.com/
按照docker官方文档(armhf)步骤安装docker-ce
# 1 更新源sudo apt-get update# 2 添加系统https支持sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common # 3 添加Docker官方GPG keycurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -# 4 查看指纹与官方文档进行对比apt-key fingerprint 0EBFCD88# 5 添加Docker官方仓库(armhf)## 实战中,按照官方文档命令添加源会将 sources.list 原有内容覆盖,建议手动添加防止出错。## vi /etc/apt/sources.list## 末尾添加以下源deb [arch=armhf] https://download.docker.com/linux/ubuntu trusty stable# 6 更新index文件apt-get update# 7 安装Dockersudo apt-get install docker-ce
安装完成后查看版本
docker version
root@localhost:/etc/apt# docker versionClient: Version: 18.06.1-ce API version: 1.38 Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:31:28 2018 OS/Arch: linux/arm Experimental: falseCannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?root@localhost:/etc/apt#
提示docker daemon 未运行,尝试重启docker daemon
# 重启docker服务service docker restart
root@localhost:/etc/apt# service docker restartstop: Unknown instance: docker start/running, process 18039root@localhost:/etc/apt#
重启未报错,但仍然提示docker daemon 未运行。
手动启动 dockerd 查看错误信息提示。
# 停止docker服务service docker stop# 手动启动dockerdsudo dockerd
发现以下报错信息
末尾提示 cgroup
错误,往上还有auf
overlay
等文件系统错误,查看linux内核发现版本为4.1.15
属于较新版本内核,理应支持这些功能。
与硬件供应商沟通后,了解到此开发板的Ubuntu内核为自行编译版本,编译前会精简掉不需要的额外功能以降低系统资源消耗,可在编译之前打开相关选项。
按此推理,Ubuntu官方发行版本内核应该不会出现此错误(待实验考证)
联系硬件工程师打开cgroup
overlay
选项重新编译内核。
重新运行测试
末尾报iptables错误,经测试iptables已安装最新版本,初步排查为内核缺少ip_tables
模块。
联系硬件工程师重新编译内核,更新相关网络模块后,docker daemon成功运行.
root@localhost:~# docker versionClient: Version: 18.06.1-ce API version: 1.38 Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:31:28 2018 OS/Arch: linux/arm Experimental: falseServer: Engine: Version: 18.06.1-ce API version: 1.38 (minimum version 1.12) Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:27:15 2018 OS/Arch: linux/arm Experimental: falseroot@localhost:~#
尝试pull一个centos镜像
docker pull centos
root@localhost:~# docker pull centosUsing default tag: latestError response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate has expired or is not yet valid
提示证书过期,之前已经更新过CA证书,怀疑是系统时间问题
# 查看系统时间date
果然,更新内核后,系统时间变为了1970年
root@localhost:~# dateThu Jan 1 00:01:19 UTC 1970
更改为当前日期后,恢复正常。
root@localhost:~# docker pull centosUsing default tag: latestlatest: Pulling from library/centosf98cb03e8d55: Pull complete Digest: sha256:6f6d986d425aeabdc3a02cb61c02abb2e78e57357e92417d6d58332856024fafStatus: Downloaded newer image for centos:latestroot@localhost:~#
更新中。。。
2018年8月23日
转载地址:http://hhcta.baihongyu.com/