2. docker之疑难杂症
docker下载镜像报错:x509: certificate has expired or is not yet valid
docker pull centos:centos5
Pulling repository centos
FATA[0004] Get https://index.docker.io/v1/repositories/library/centos/images: x509: certificate has expired or is not yet valid
这种错误,一般都是本地系统时间错误导致报错证书过期,所以先查看本地系统时间
通过 ntpdate cn.pool.ntp.org
更新系统时间
docker 执行 docker exec -it d bash
报错,错误信息如下
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "process_linux.go:110: decoding init error from pipe caused \"read parent: connection reset by peer\""
当前版本信息:
root@localhost ~]# docker version
Client:
Version: 1.13.1
API version: 1.26
Package version: docker-1.13.1-84.git07f3374.el7.centos.x86_64
Go version: go1.10.2
Git commit: 07f3374/1.13.1
Built: Fri Nov 30 02:48:45 2018
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Package version: docker-1.13.1-84.git07f3374.el7.centos.x86_64
Go version: go1.10.2
Git commit: 07f3374/1.13.1
Built: Fri Nov 30 02:48:45 2018
OS/Arch: linux/amd64
Experimental: false
错误原因
docker bug 在1.10版本修复
但是在1.13.1-84复现
解决办法,安装其它版本docker
如 yum install docker-1.13.1-75.git8633870.el7.centos.x86_64
docker镜像存储调整
调整配置文件目的
- 镜像的默认存储位置
- 镜像加速地址
调整步骤
- 修改文件/etc/docker/daemon.json
- 修改daemon.json内容为
{
"registry-mirrors": ["https://7bezldxe.mirror.aliyuncs.com","https://hub.c.163.com","https://harbor.kanche.com","http://8d6045ed.m.daocloud.io"], # 镜像读取目录
"live-restore": true,
"max-concurrent-downloads": 3,
"max-concurrent-uploads": 5,
"graph": "/data1/docker/storage/" # 镜像本地存储目录
}