SRE日常问题收集与知识学习
2024-04-17 14:10:58
问题记录
docker 启动失败
- 问题描述:
systemctl start docker
失败报错信息如下: ```bash ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sun 2024-04-21 13:00:00 CST; 59min ago Docs: http://docs.docker.com Process: 37591 ExecStart=/usr/bin/dockerd-current –add-runtime docker-runc=/usr/libexec/docker/docker-runc-current –default-runtime=docker-runc –exec-opt native.cgroupdriver=systemd –userland-proxy-path=/usr/libexec/docker/docker-proxy-current –init-path=/usr/libexec/docker/docker-init-current –seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE) Main PID: 37591 (code=exited, status=1/FAILURE)
Apr 21 13:00:00 localhost systemd[1]: Starting Docker Application Container Engine… Apr 21 13:00:00 localhost dockerd-current[37591]: unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: runtimes: (from flag: [docker-runc], from file: map[nvidia:map[path:/usr/bin/nvidia-container-runtime runtimeArgs:[]]]), default-runtime: (from flag: docker-runc, from file: nvidia), exec-opts: (from flag: [native.cgroupdriver=systemd], from file: [native.cgroupdriver=systemd]) Apr 21 13:00:00 localhost systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE Apr 21 13:00:00 localhost systemd[1]: Failed to start Docker Application Container Engine. Apr 21 13:00:00 localhost systemd[1]: Unit docker.service entered failed state. Apr 21 13:00:00 localhost systemd[1]: docker.service failed.
- 原因定位:一开始是以为配置文件问题,查询后发现和线上其它主机配置文件一致。最终查看了一下docker版本。发现是docker版本为默认`1.13.1` 版本过低导致
- 解决方法:安装最新docker即可。
```bash
# 1. 查询当前docker 版本
docker verison
# Docker version 1.13.1, build 7d71120/1.13.1
# 查询可用docker 版本
yum list docker-ce --showduplicates | sort -r
# 删除旧版本docker
yum remove docker docker-common docker-selinux docker-engine
# 安装新版本docker
yum -y install docker-ce
# docker pull 异常
# Error response from daemon: unauthorized: authentication required
# 需要重新进行身份认证
docker login xxx:xxx
# docker 查询可用镜像
docker search go
# 拉取镜像
docker pull xxxx