這邊博文寫的很ok: http://www.javashuo.com/article/p-dozxjzkv-bk.htmlhtml
docker 啓動報錯,使用 systemctl 或 journalctl 查看錯誤以下:linux
[root@iZ23lj7d0igZ etc]# systemctl status docker.service ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: failed (Result: start-limit) since Thu 2019-01-24 14:12:25 CST; 3s ago Docs: https://docs.docker.com Process: 19664 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE) Main PID: 19664 (code=exited, status=1/FAILURE) Jan 24 14:12:23 iZ23lj7d0igZ systemd[1]: Failed to start Docker Application Container Engine. Jan 24 14:12:23 iZ23lj7d0igZ systemd[1]: Unit docker.service entered failed state. Jan 24 14:12:23 iZ23lj7d0igZ systemd[1]: docker.service failed. Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: docker.service holdoff time over, scheduling restart. Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: Stopped Docker Application Container Engine. Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: start request repeated too quickly for docker.service Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: Failed to start Docker Application Container Engine. Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: Unit docker.service entered failed state. Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: docker.service failed.
其實 systemctl 或 journalctl 並不能很準確的看出問題所在,直接啓動 dockerd 能獲取更爲準確的錯誤信息docker
[root@iZ23lj7d0igZ docker]# dockerd INFO[2019-01-24T14:22:09.818767600+08:00] parsed scheme: "unix" module=grpc INFO[2019-01-24T14:22:09.819747980+08:00] scheme "unix" not registered, fallback to default scheme module=grpc INFO[2019-01-24T14:22:09.819949065+08:00] parsed scheme: "unix" module=grpc INFO[2019-01-24T14:22:09.820053953+08:00] scheme "unix" not registered, fallback to default scheme module=grpc WARN[2019-01-24T14:22:09.820285915+08:00] [graphdriver] WARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release INFO[2019-01-24T14:22:09.821538282+08:00] ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0 <nil>}] module=grpc INFO[2019-01-24T14:22:09.821696754+08:00] ClientConn switching balancer to "pick_first" module=grpc INFO[2019-01-24T14:22:09.822488994+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420164670, CONNECTING module=grpc INFO[2019-01-24T14:22:09.823961880+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420164670, READY module=grpc INFO[2019-01-24T14:22:09.824312951+08:00] ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0 <nil>}] module=grpc INFO[2019-01-24T14:22:09.824456097+08:00] ClientConn switching balancer to "pick_first" module=grpc INFO[2019-01-24T14:22:09.824597236+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420164a20, CONNECTING module=grpc INFO[2019-01-24T14:22:09.825544332+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420164a20, READY module=grpc WARN[2019-01-24T14:22:09.834966889+08:00] Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man dockerd` to refer to dm.thinpooldev section. storage-driver=devicemapper INFO[2019-01-24T14:22:10.345190914+08:00] Creating filesystem xfs on device docker-253:1-3016960-base, mkfs args: [-m crc=0,finobt=0 /dev/mapper/docker-253:1-3016960-base] storage-driver=devicemapper INFO[2019-01-24T14:22:10.353324179+08:00] Error while creating filesystem xfs on device docker-253:1-3016960-base: exit status 1 storage-driver=devicemapper Error starting daemon: error initializing graphdriver: exit status 1
#vim /etc/sysconfig/docker OPTIONS="--selinux-enabled --log-driver=journald --signature-verification=false" #vim /etc/docker/daemon.json 注意不要拼寫錯誤 {"storage-driver": "devicemapper"} #重啓docker服務 systemclt restart docker.service
若是依然沒法啓動能夠將 /etc/docker/daemon.json 改成 /etc/docker/daemon.conf 嘗試一下。json
這是因爲系統 xfsprogs 版本太低形成的,更新一下便可(https://www.cnblogs.com/loopsun/p/9650301.html)vim
yum install xfsprogs
新版的 docker 要求系統內核版本在 3.10 以上,能夠使用 uname -r 查看本身的系統版本,低於 3.10 的話請升級內核。bash
uname -r 3.10.0-123.9.3.el7.x86_64
以上基本能夠解決 docker 啓動的錯誤,推薦個 docker 加速器,傻瓜式安裝 docker docker-compose DaoCloud: http://get.daocloud.io/app