I should be able to retrieve CPU usage information from the process table of a Docker container on Mac.
Actual behavior
Attempting to retrieve CPU usage information causes an error.
Information
Pinata output
OS X: version 10.11.5 (build: 15F34)
Docker.app: version v1.11.1-beta12
Running diagnostic tests:
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160524-105904.tar.gz
Most specific failure is: No error was detected
Your unique id is: C7EE1F29-FE15-48B3-A118-4680F0C7B27B
Please quote this in all correspondence.
Steps to reproduce the behavior
Start a docker container.
Execute docker top [containerid] a -o pid,%cpu
On my Ubuntu system that command produces output like this.
PID %CPU
2453 0.0
On my OS X system that command produces this output:
Error response from daemon: Error running ps: exit status 1
If you have been running the alternative Docker, please can you check you
are not running in a
term which includes settings for it. Try ‘env | grep ^DO’ to make sure
that there are no environment
variables set for the alternative environment/setup.
Do everything else work as expected? Quite a few people are reporting issues since upgrading to OS X 10.11.5. Seems like something to do with the /var/run/docker.sock. Workarounds available in other threads.
Yeah, everything else is working fine. If this were an issue with the docker socket I wouldn’t even be able to docker ps. I think this has something to do with the instance of ps installed on the xhyve VM that DockerVM is running the docker daemon in…
Seems so. On the Docker (for Mac) host: ps a -o pid,%cpu ps: bad -o argument '%cpu', supported arguments: user,group,comm,args,pid,ppid,pgid,etime,nice,rgroup,ruser,time,tty,vsz,stat,rss
And indeed, on my workstation the following work OK: docker top [] a -o pid,user,group,comm,args,ppid,pgid,etime,nice,rgroup,ruser,time,tty,vsz,stat,rss
Don’t know how to get the CPU out of this then.
Docker for Mac ps info: ps --version ps: unrecognized option: version BusyBox v1.24.1 (2015-12-16 08:00:02 GMT) multi-call binary.