moby: docker stats show a wrong value of block write I/O when using dd if=/dev/zero in a container

Description when we use dd if=/dev/zero command in a centos container, like we write a 1GB file with /dev/zero for 4 times, theoritically, docker stats should show 4GB or 0GB in the block write I/O(I have not research the way docker write zero, maybe really write zero maybe not), however it is not, the block write I/O is 9GB, and every time you redo the process above, the docker stats result is different but not the right result we think should.

Steps to reproduce the issue:

  1. docker run -d --name=hx-test centos ping www.baidu.com
  2. docker exec -it hx-test /bin/bash
  3. dd if=/dev/zero of=./test.txt count=1000 bs=1M (you can redo this for 4 times)
  4. docker stats

Describe the results you received: the stdout of docker stats is not right on BLOCK I/O

Describe the results you expected: the BLOCK write I/O of docker stats should be 0GB or 4GB

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 137
 Running: 14
 Paused: 0
 Stopped: 123
Images: 41
Server Version: 1.12.1
Storage Driver: devicemapper
 Pool Name: docker-thinpool
 Pool Blocksize: 524.3 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: 
 Metadata file: 
 Data Space Used: 47.59 GB
 Data Space Total: 1.1 TB
 Data Space Available: 1.052 TB
 Metadata Space Used: 17.2 MB
 Metadata Space Total: 10.74 GB
 Metadata Space Available: 10.72 GB
 Thin Pool Minimum Free Space: 110 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: true
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Library Version: 1.02.107-RHEL7 (2016-06-09)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: vlcp bridge host null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 3.10.0-327.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 48
Total Memory: 251.6 GiB
Name: kvm-yz-dev-073-003-004
ID: CED3:DJX6:VW6I:LJLX:CEVJ:Z4L2:FYPX:KTIQ:CTO2:4JRD:U7L3:WN4L
Docker Root Dir: /data/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-ip6tables is disabled
Cluster Store: zk://100.73.3.4:2181,100.73.3.5:2181,100.73.3.6:2181
Cluster Advertise: 100.73.3.4:2375
Insecure Registries:
 jdocker.me
 127.0.0.0/8

Additional environment details (AWS, VirtualBox, physical, etc.): centos7.2 pysical machine

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 15 (8 by maintainers)

Most upvoted comments

dd if=/dev/zero of=./test.txt count=1000 bs=1M if=/dev/zero is a character device,but the block I/O is a block device so the docker stats show a “wrong” value.