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=/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=
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=
LimitNPROC=
LimitCORE=infinity
TimeoutStartSec=
Restart=on-abnormal
KillMode=process [Install]
WantedBy=multi-user.target cat /etc/sysconfig/docker-storage DOCKER_STORAGE_OPTIONS="--storage-driver overlay2 "
尝试执行dockerd 命令,结果运行成功,提示:
dockerd
INFO[] libcontainerd: new containerd process, pid:
WARN[] containerd: low RLIMIT_NOFILE changing to max current= max=
INFO[] [graphdriver] using prior storage driver: btrfs
INFO[] Graph migration to content-addressability took 0.00 seconds
INFO[] Loading containers: start.
INFO[] Firewalld running: false
INFO[] Default bridge (docker0) is assigned with an IP address 172.17.0.0/. Daemon option --bip can be used to set a preferred IP address
INFO[] Loading containers: done.
WARN[] failed to retrieve docker-runc version: exec: "docker-runc": executable file not found in $PATH
WARN[] failed to retrieve docker-init version
INFO[] Daemon has completed initialization
INFO[] Docker daemon commit="07f3374/1.13.1" graphdriver=btrfs version=1.13.
INFO[] 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 学习.