DockerClientpp is a simple docker client sdk written in C++
This library heavily relies on Linux platform
DockerClient dc // Instantiate a client with default option: connect to /var/run/docker.sock
DockerClient dc(SOCK_TYPE::UNIX, "/path/to/docker/daemon/socket");
DockerClient dc(SOCK_TYPE::TCP, "IP:Port");
string container_id = dc.createContainer({
{"AttachStdout", true},
{"AttachStderr", true},
{"Tty", true},
{"StopSignal", "SIGKILL"},
{"Image", "busybox:1.26"}
}, "test");
ExecRet result = dc.executeCommand(container_id, {"echo", "hello DockerClientpp"});
std::cout << result.ret_code << std::endl
<< result.output << std::endl;
Note:
- For more usage, see hello_world.cpp
- For complete API reference, see header file or documentation
- For configuration passed in docker client see Docker Engine API
git clone --recursive https://github.com/tommyleo2/DockerClientpp.git
cd DockerClientpp
mkdir build
cd build
cmake ..
make install
(with root permission)
The library's name is libDockerClientpp.a
Use Headers #include <dockerclientpp/DockerClientpp.hpp>
in your project
After cmake configuration, execute make doc
. The doc files will be put under /<DockerClient root directory>/doc
- add subdirectory
- link
DOCKER_CLIENT_PP_LIB
to your targets