当把exec-opt native.cgroupdriver改成"cgroupfs"时,docker不能运行正确吗?
when change exec-opt native.cgroupdriver to "cgroupfs",docker can not run correct?
my os version : centos7.3
kenerl version : 3.10.0-514.16.1.el7.x86_64
docker version : 1.12.6
我修改配置文件“/lib/systemd/system/docker.service”,将选项“--exec-opt native.cgroupdriver”从systemd更改为cgroupfs。我发现 docker 不能 运行 任何图像!
[root@surenode2 system]# cat /lib/systemd/system/docker.service |grep cgroup
--exec-opt native.cgroupdriver=cgroupfs \
[root@surenode2 system]# docker images | grep mysql
docker.io/mysql latest e799c7f9ae9c 3 weeks ago 407.3 MB
[root@surenode2 system]# docker run -p 3307:3307 -e MYSQL_ROOT_PASSWORD=123456 -d mysql
3395c8d505d3fc20d39e25c510a090649f9f447bce985028ea7274e79183d077
/usr/bin/docker-current: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"process_linux.go:334: running prestart hook 1 caused \\"error running hook: exit status 1, stdout: , stderr: \\"\"\n".
而且,如果我将 exec-opt native.cgroupdriver 更改为 systemd ,Docker 可以 运行 任何图像..
Docker 1.12.6 ("community edition") 已停产,不再受支持;
我们可以安装最新的docker版本参考'https://docs.docker.com/engine/installation/linux/centos/'。
使用最新的docker版本时,此问题不再重现!
[root@surenode1 ~]# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.05.0-ce
Storage Driver: devicemapper
Pool Name: docker-253:1-393732-pool
Pool Blocksize: 65.54kB
Base Device Size: 10.74GB
Backing Filesystem: xfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 11.8MB
Data Space Total: 107.4GB
Data Space Available: 50.86GB
Metadata Space Used: 581.6kB
Metadata Space Total: 2.147GB
Metadata Space Available: 2.147GB
Thin Pool Minimum Free Space: 10.74GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Deferred Deletion Enabled: false
Deferred Deleted Device Count: 0
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.135-RHEL7 (2016-11-16)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-514.16.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.702GiB
Name: surenode1
ID: NIYU:7BRX:JIQP:ZJMW:ZV6N:3336:5JSB:MWVQ:WR72:AO7J:QOEW:CHCA
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
[root@surenode1 ~]# docker version
Client:
Version: 17.05.0-ce
API version: 1.29
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:10:29 2017
OS/Arch: linux/amd64
Server:
Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:10:29 2017
OS/Arch: linux/amd64
Experimental: false
[root@surenode1 tmp]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest e799c7f9ae9c 3 weeks ago 407MB
[root@surenode1 tmp]# ps -ef | grep docker
root 10173 1 1 17:31 ? 00:00:03 /usr/bin/dockerd **--exec-opt native.cgroupdriver=cgroupfs**
root 10177 10173 0 17:31 ? 00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc
root 10535 9634 0 17:34 pts/0 00:00:00 grep --color=auto docker
[root@surenode1 tmp]# docker run -p 3307:3307 -e MYSQL_ROOT_PASSWORD=123456 -d mysql
8f2d30ea779b872604bdf0d3d500de16e17d1409cdc5b2688893202bfcebbf16
[root@surenode1 tmp]#
此外,我们可以找到有关此问题的错误描述。
https://bugzilla.redhat.com/show_bug.cgi?id=1444662
my os version : centos7.3
kenerl version : 3.10.0-514.16.1.el7.x86_64
docker version : 1.12.6
我修改配置文件“/lib/systemd/system/docker.service”,将选项“--exec-opt native.cgroupdriver”从systemd更改为cgroupfs。我发现 docker 不能 运行 任何图像!
[root@surenode2 system]# cat /lib/systemd/system/docker.service |grep cgroup
--exec-opt native.cgroupdriver=cgroupfs \
[root@surenode2 system]# docker images | grep mysql
docker.io/mysql latest e799c7f9ae9c 3 weeks ago 407.3 MB
[root@surenode2 system]# docker run -p 3307:3307 -e MYSQL_ROOT_PASSWORD=123456 -d mysql
3395c8d505d3fc20d39e25c510a090649f9f447bce985028ea7274e79183d077
/usr/bin/docker-current: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"process_linux.go:334: running prestart hook 1 caused \\"error running hook: exit status 1, stdout: , stderr: \\"\"\n".
而且,如果我将 exec-opt native.cgroupdriver 更改为 systemd ,Docker 可以 运行 任何图像..
Docker 1.12.6 ("community edition") 已停产,不再受支持;
我们可以安装最新的docker版本参考'https://docs.docker.com/engine/installation/linux/centos/'。
使用最新的docker版本时,此问题不再重现!
[root@surenode1 ~]# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.05.0-ce
Storage Driver: devicemapper
Pool Name: docker-253:1-393732-pool
Pool Blocksize: 65.54kB
Base Device Size: 10.74GB
Backing Filesystem: xfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 11.8MB
Data Space Total: 107.4GB
Data Space Available: 50.86GB
Metadata Space Used: 581.6kB
Metadata Space Total: 2.147GB
Metadata Space Available: 2.147GB
Thin Pool Minimum Free Space: 10.74GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Deferred Deletion Enabled: false
Deferred Deleted Device Count: 0
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.135-RHEL7 (2016-11-16)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-514.16.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.702GiB
Name: surenode1
ID: NIYU:7BRX:JIQP:ZJMW:ZV6N:3336:5JSB:MWVQ:WR72:AO7J:QOEW:CHCA
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
[root@surenode1 ~]# docker version
Client:
Version: 17.05.0-ce
API version: 1.29
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:10:29 2017
OS/Arch: linux/amd64
Server:
Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:10:29 2017
OS/Arch: linux/amd64
Experimental: false
[root@surenode1 tmp]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest e799c7f9ae9c 3 weeks ago 407MB
[root@surenode1 tmp]# ps -ef | grep docker
root 10173 1 1 17:31 ? 00:00:03 /usr/bin/dockerd **--exec-opt native.cgroupdriver=cgroupfs**
root 10177 10173 0 17:31 ? 00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc
root 10535 9634 0 17:34 pts/0 00:00:00 grep --color=auto docker
[root@surenode1 tmp]# docker run -p 3307:3307 -e MYSQL_ROOT_PASSWORD=123456 -d mysql
8f2d30ea779b872604bdf0d3d500de16e17d1409cdc5b2688893202bfcebbf16
[root@surenode1 tmp]#
此外,我们可以找到有关此问题的错误描述。
https://bugzilla.redhat.com/show_bug.cgi?id=1444662