Hello everyone.
I am running docker for Windows on Windows 10 with 1709 update with Windows containers. Docker version is 17.09.0-ce-win33 stable. (Though I have tried it on latest edge distro) I am trying to access container stats via REST API from localhost. http://localhost:2375/containers/some-container-id/stats returns 0 on some fields, either with or without stream option. The output is as follows.
> {
> "read": "2017-11-25T23:53:12.4978866Z",
> "preread": "2017-11-25T23:53:11.4979728Z",
> "pids_stats": {
>
> },
> "blkio_stats": {
> "io_service_bytes_recursive": null,
> "io_serviced_recursive": null,
> "io_queue_recursive": null,dock
> "io_service_time_recursive": null,
> "io_wait_time_recursive": null,
> "io_merged_recursive": null,
> "io_time_recursive": null,
> "sectors_recursive": null
> },
> "num_procs": 4,
> "storage_stats": {
> "read_count_normalized": 2196,
> "read_size_bytes": 16348672,
> "write_count_normalized": 2543,
> "write_size_bytes": 18244608
> },
> "cpu_stats": {
> "cpu_usage": {
> "total_usage": 94521638,
> "usage_in_kernelmode": 0,
> "usage_in_usermode": 0
> },
> "throttling_data": {
> "periods": 0,
> "throttled_periods": 0,
> "throttled_time": 0
> }
> },
> "precpu_stats": {
> "cpu_usage": {
> "total_usage": 94507005,
> "usage_in_kernelmode": 0,
> "usage_in_usermode": 0
> },
> "throttling_data": {
> "periods": 0,
> "throttled_periods": 0,
> "throttled_time": 0
> }
> },
> "memory_stats": {
> "commitbytes": 1083678720,
> "commitpeakbytes": 1084067840,
> "privateworkingset": 89411584
> },
> "name": "\/tracker_webapi_1",
> "id": "1803b3b2ae4df306a2308b8e1263fd6b1dc03af2d2cd649559b251d02ff58f13",
> "networks": {
> "754f669d-feff-49f2-ab15-7c76a6c4e73f": {
> "rx_bytes": 0,
> "rx_packets": 0,
> "rx_errors": 0,
> "rx_dropped": 0,
> "tx_bytes": 0,
> "tx_packets": 0,
> "tx_errors": 0,
> "tx_dropped": 0
> }
> }
> }
As you can see there’s a lot of 0s and nulls. I would expect to see some data in blkio_stats
or cpu_usage
. Other API functions seem alright, such as container http://localhost:2375/containers/json etc (and if there is a problem, I do not know yet) but stats
is causing problem. Calling docker stats
fom powershell works alright.
When I switch to linux containers, it works ok. The JSON structure that returns is different as well:
{ "read": "2017-11-26T00:03:58.2432189Z", "preread": "2017-11-26T00:03:57.2426677Z", "pids_stats": { "current": 75 }, "blkio_stats": { "io_service_bytes_recursive": [ { "major": 8, "minor": 0, "op": "Read", "value": 0 }, { "major": 8, "minor": 0, "op": "Write", "value": 389120 }, { "major": 8, "minor": 0, "op": "Sync", "value": 360448 }, { "major": 8, "minor": 0, "op": "Async", "value": 28672 }, { "major": 8, "minor": 0, "op": "Total", "value": 389120 } ], "io_serviced_recursive": [ { "major": 8, "minor": 0, "op": "Read", "value": 0 }, { "major": 8, "minor": 0, "op": "Write", "value": 75 }, { "major": 8, "minor": 0, "op": "Sync", "value": 68 }, { "major": 8, "minor": 0, "op": "Async", "value": 7 }, { "major": 8, "minor": 0, "op": "Total", "value": 75 } ], "io_queue_recursive": [ ], "io_service_time_recursive": [ ], "io_wait_time_recursive": [ ], "io_merged_recursive": [ ], "io_time_recursive": [ ], "sectors_recursive": [ ] }, "num_procs": 0, "storage_stats": { }, "cpu_stats": { "cpu_usage": { "total_usage": 14608679301, "percpu_usage": [ 9723550801, 4885128500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], "usage_in_kernelmode": 5840000000, "usage_in_usermode": 8680000000 }, "system_cpu_usage": 7049490000000, "online_cpus": 2, "throttling_data": { "periods": 0, "throttled_periods": 0, "throttled_time": 0 } }, "precpu_stats": { "cpu_usage": { "total_usage": 14607358231, "percpu_usage": [ 9722418623, 4884939608, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], "usage_in_kernelmode": 5840000000, "usage_in_usermode": 8680000000 }, "system_cpu_usage": 7047530000000, "online_cpus": 2, "throttling_data": { "periods": 0, "throttled_periods": 0, "throttled_time": 0 } }, "memory_stats": { "usage": 77393920, "max_usage": 80232448, "stats": { "active_anon": 70942720, "active_file": 69632, "cache": 151552, "dirty": 0, "hierarchical_memory_limit": 9.2233720368548e+18, "hierarchical_memsw_limit": 9.2233720368548e+18, "inactive_anon": 0, "inactive_file": 81920, "mapped_file": 0, "pgfault": 140336, "pgmajfault": 0, "pgpgin": 89629, "pgpgout": 72272, "rss": 70942720, "rss_huge": 0, "swap": 0, "total_active_anon": 70942720, "total_active_file": 69632, "total_cache": 151552, "total_dirty": 0, "total_inactive_anon": 0, "total_inactive_file": 81920, "total_mapped_file": 0, "total_pgfault": 140336, "total_pgmajfault": 0, "total_pgpgin": 89629, "total_pgpgout": 72272, "total_rss": 70942720, "total_rss_huge": 0, "total_swap": 0, "total_unevictable": 0, "total_writeback": 0, "unevictable": 0, "writeback": 0 }, "limit": 2076430336 }, "name": "\/rabbit", "id": "cdc291fd78a0bf7aa8212befbbf08fc9c619529aee313ac1f3f6ffac8b239231", "networks": { "eth0": { "rx_bytes": 5796, "rx_packets": 140, "rx_errors": 0, "rx_dropped": 0, "tx_bytes": 0, "tx_packets": 0, "tx_errors": 0, "tx_dropped": 0 } } }
I was unable to find any information on this issue. Am I missing something, is there a workaround, or shall i wait until these issues are resolved by Docker or Windows? Any help is greatly appreciated.
Thank you and have a great day