WIP: WARNING: Do not expect full API support.
A simple C++ client to comunicate with a local or remote Docker server.
#include <docker_cpp/docker.h>
using namespace docker_cpp;
Docker<ASLHttp> docker("http://127.0.0.1:2375");There is a helper function to check if a connection with the docker server can be established.
bool ok = docker.checkConnection();
if (ok) {
// The client can communicate with the docker engine.
...
}For example, to get the collection of images in the docker server:
ImageList images;
DockerError err = docker.imageList(images);
if (err.isOk()) {
// images is a vector populated with information about each docker image
for (ImageInfo &im : images) { // To print the id of each image
std::cout << "ID: " << im.id << '\n';
}
}else{
std::cerr << "ERROR: List of image could not be retrieved!" << '\n';
}For more examples, see the samples directory an also check the API coverage.
- ASL - All-purpose Simple Library
Developed with version v1.40 of the docker API engine.
(:100:: Tested, :heavy_check_mark:: It may work, :clock9:: planned, :x:: Not supported)
| API Feature | Supported |
|---|---|
| Authentication | ❌ |
| System | |
| Check auth config | ❌ |
| Get system information | ❌ |
| Get version | ✔️ |
| Ping | ✔️ |
| Monitor events | ❌ |
| Get data usage information | ❌ |
| Images | |
| List images | ✔️ |
| Build an image | 🕘 |
| Delete builder cache | ❌ |
| Create an image | ✔️ |
| Inspect an image | ❌ |
| Get history of an image | ❌ |
| Push an image | ❌ |
| Tag an image | ✔️ |
| Remove an image | ✔️ |
| Search images | ❌ |
| Delete unused images | ✔️ |
| Create a new image from cont. | ❌ |
| Export an image | ❌ |
| Export several images | ❌ |
| Import images | ❌ |
| Containers | |
| List containers | 🕘 |
| Create a container | 🕘 |
| Inspect a container | ❌ |
| List processes running inside a container | ❌ |
| Get container logs | ❌ |
| Get changes on a container's filesystem | ❌ |
| Export a container | ❌ |
| Get container stats | ❌ |
| Resize a container TTY | ❌ |
| Start a container | ✔️ |
| Restart a container | ✔️ |
| Kill a container | ✔️ |
| Update a container | ❌ |
| Rename a container | ✔️ |
| Pause a container | 🕘 |
| Unpause a container | 🕘 |
| Attatch to a container | ❌ |
| Attatch to a container webs. | ❌ |
| Wait for a container | ❌ |
| Remove a container | ✔️ |
| Get information about files in container | ❌ |
| Get an archive of a filesystem resource in a container | ❌ |
| Extract an archive of files or folders to a directory in a container | ❌ |
| Delete stopped containers | 🕘 |
| Networks | ❌ |
| Volumes | ❌ |
| Exec | |
| Create an exec instance | ✔️ |
| Start an exec instance | ✔️ |
| Resize an exec instance | ✔️ |
| Inspect an exec instance | ✔️ |
| Swarm | ❌ |
| Nodes | ❌ |
| Services | ❌ |
| Tasks | ❌ |
| Secrets | ❌ |
| Configs | ❌ |
| Plugins | ❌ |
| Distribution | ❌ |