Refactoring to use Docker sockets directly as well as fork() to call processes instead of opening shells
This commit is contained in:
parent
6635446438
commit
802550f6e7
9 changed files with 720 additions and 1229 deletions
23
src/docker_engine_client.hpp
Normal file
23
src/docker_engine_client.hpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
struct EngineResponse {
|
||||
int status_code = 0;
|
||||
std::string body;
|
||||
std::string error;
|
||||
|
||||
bool ok() const { return status_code >= 200 && status_code < 300 && error.empty(); }
|
||||
};
|
||||
|
||||
class DockerEngineClient {
|
||||
public:
|
||||
explicit DockerEngineClient(std::string socket_path = "/var/run/docker.sock");
|
||||
|
||||
EngineResponse request(const std::string& method,
|
||||
const std::string& path,
|
||||
const std::string& body = {}) const;
|
||||
|
||||
private:
|
||||
std::string socket_path_;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue