1. 程式人生 > >解決 docker 報錯: Error starting daemon: error initializing graphdriver: backing file system is unsupported for this graph driver

解決 docker 報錯: Error starting daemon: error initializing graphdriver: backing file system is unsupported for this graph driver

CentOS 7.5 x64下

sudo yum install docker -y 

systemctl enable docker

systemctl start docker

發現啟動失敗

journalctl -xe

查詢獲得報錯


Jan 11 22:49:16 localhost.localdomain dockerd-current[29403]: time="2019-01-11T22:49:16.686305029+08:00" level=info msg="libcontainerd: new containerd process, pid: 29410"
Jan 11 22:49:17 localhost.localdomain dockerd-current[29403]: time="2019-01-11T22:49:17.696062387+08:00" level=error msg="'overlay2' requires kernel 4.7 to use on btrfs"
Jan 11 22:49:17 localhost.localdomain dockerd-current[29403]: Error starting daemon: error initializing graphdriver: backing file system is unsupported for this graph driver


docker.service: main process exited, code=exited, status=1/FAILURE

Failed to start Docker Application Container Engine.

 

然後搜尋了一番,暫時沒找到。 然後就自己研究一下。

cat /etc/systemd/system/multi-user.target.wants/docker.service


[Unit]
Description=Docker Application Container Engine
Documentation
=http://docs.docker.com After=network.target Wants=docker-storage-setup.service Requires=docker-cleanup.timer [Service] Type=notify NotifyAccess=main EnvironmentFile=-/run/containers/registries.conf EnvironmentFile=-/etc/sysconfig/docker EnvironmentFile=-/etc/sysconfig/docker-storage EnvironmentFile
=-/etc/sysconfig/docker-network Environment=GOTRACEBACK=crash Environment=DOCKER_HTTP_HOST_COMPAT=1 Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin 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 ExecReload=/bin/kill -s HUP $MAINPID LimitNOFILE=1048576 LimitNPROC=1048576 LimitCORE=infinity TimeoutStartSec=0 Restart=on-abnormal KillMode=process [Install] WantedBy=multi-user.target cat /etc/sysconfig/docker-storage DOCKER_STORAGE_OPTIONS="--storage-driver overlay2 "

嘗試執行dockerd 命令,結果執行成功,提示:

dockerd
INFO[0000] libcontainerd: new containerd process, pid: 29626 
WARN[0000] containerd: low RLIMIT_NOFILE changing to max  current=1024 max=4096
INFO[0001] [graphdriver] using prior storage driver: btrfs 
INFO[0001] Graph migration to content-addressability took 0.00 seconds 
INFO[0001] Loading containers: start.                   
INFO[0001] Firewalld running: false                     
INFO[0001] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address 
INFO[0001] Loading containers: done.                    
WARN[0001] failed to retrieve docker-runc version: exec: "docker-runc": executable file not found in $PATH 
WARN[0001] failed to retrieve docker-init version       
INFO[0001] Daemon has completed initialization          
INFO[0001] Docker daemon                                 commit="07f3374/1.13.1" graphdriver=btrfs version=1.13.1
INFO[0001] API listen on /var/run/docker.sock           

發現了關鍵字:   graphdriver=btrfs 以及之前的報錯有提示:  error msg="'overlay2' requires kernel 4.7 to use on btrfs"

所以嘗試修改 /etc/sysconfig/docker-storage 為:
DOCKER_STORAGE_OPTIONS="--storage-driver btrfs "

重新啟動docker:

systemctl start docker

啟動成功.問題解決!

下面開始 docker 學習.