Docker by Karl Matthias
Author:Karl Matthias
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2015-06-24T16:00:00+00:00
$ docker stats e64a279663aa CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O e64a279663aa 0.00% 7.227 MiB/987.9 MiB 0.73% 936 B/468 B
Here we can see the container ID (but not the name), the amount of CPU it’s currently consuming, the amout of memory it has in use, and the limit of what it’s allowed to use. The percentage of memory utilized is also provided to make it easier for the user to quickly determine how much free memory the container has available. And stats are provided for both in and out network bytes.
These are all of basic interest, but what they provide is not all that exciting. It turns out, though, that the Docker API provides a lot more information on the stats endpoint than is shown in the client. We’ve steered away from hitting the API in this book so far, but in this case the data provided by the API is so much richer that we’ll use curl to call it and see what our container is doing. It’s nowhere near as nice to read, but there is a lot more detail. This is a good intro to calling the API yourself as well.
The /stats/ endpoint that we’ll hit on the API will continue to stream stats to us as long as we keep the connection open. Since as humans we can’t really parse usefully, we’ll just ask for one line and then use Python to “pretty print” it. In order for this command to work, you’ll need to have Python installed (version 2.6 or later). If you don’t and you still want to see the JSON output, you can skip the pipe to Python, but you’ll get plain, ugly JSON back.
Here we call localhost, but you’ll want to use the hostname of your Docker server. Port 2375 is usually the right port. Note that we also pass the ID of our container in the URL we send to curl.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
COM, DCOM & ATL | Device Drivers |
EPOC-Symbian | Microsoft Windows Registry |
Novell Netware | Operating Systems Theory |
Unicode | Unix |
Win32 API |
Deep Learning with Python by François Chollet(12578)
Hello! Python by Anthony Briggs(9916)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Dependency Injection in .NET by Mark Seemann(9340)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8302)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7697)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7098)
Microservices with Go by Alexander Shuiskov(6865)
Practical Design Patterns for Java Developers by Miroslav Wengner(6782)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6724)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Angular Projects - Third Edition by Aristeidis Bampakos(6137)
The Art of Crafting User Stories by The Art of Crafting User Stories(5659)
NetSuite for Consultants - Second Edition by Peter Ries(5591)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5403)
Kotlin in Action by Dmitry Jemerov(5067)
