Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture image id in benchmark executions #127

Open
coryan opened this issue Feb 19, 2017 · 0 comments
Open

Capture image id in benchmark executions #127

coryan opened this issue Feb 19, 2017 · 0 comments

Comments

@coryan
Copy link
Owner

coryan commented Feb 19, 2017

The image ID is not captured by the benchmark driver. We should try to. Basically if /proc/self/cgroup has the right information in it, you can determine that you are running inside a container:

For example:

$ cat /proc/self/cgroup 
11:hugetlb:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40
10:blkio:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40
9:freezer:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40
8:pids:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40
7:net_cls,net_prio:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40
6:memory:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40
5:devices:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40
4:cpuset:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40
3:cpu,cpuacct:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40
2:perf_event:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40
1:name=systemd:/docker/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40

If that is the case, and if the container is running with --volume /var/run/docker.sock:/var/run/docker.sock you can query the container attributes using:

curl --unix-socket /var/run/docker.sock http:/v1.26/containers/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40/json

That returns a lot more information than one may want, but we should be able to get the data using something like:

curl --unix-socket /var/run/docker.sock http:/v1.26/containers/256299b017cc4f6240db3ac640d2ea4d9306da724b7be428ef844e1ac48a1d40/json | grep -o '"Id":"[a-f0-9]*"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant