| 89 | }; |
| 90 | |
| 91 | class Container |
| 92 | { |
| 93 | public: |
| 94 | static Try<Container> create( |
| 95 | const std::string& output); |
| 96 | |
| 97 | // Returns the docker inspect output. |
| 98 | const std::string output; |
| 99 | |
| 100 | // Returns the ID of the container. |
| 101 | const std::string id; |
| 102 | |
| 103 | // Returns the name of the container. |
| 104 | const std::string name; |
| 105 | |
| 106 | // Returns the pid of the container, or None if the container is |
| 107 | // not running. |
| 108 | const Option<pid_t> pid; |
| 109 | |
| 110 | // Returns if the container has already started. This field is |
| 111 | // needed since pid is empty when the container terminates. |
| 112 | const bool started; |
| 113 | |
| 114 | // Returns the IPv4 address of the container, or `None()` if no |
| 115 | // IPv4 address has been assigned. |
| 116 | const Option<std::string> ipAddress; |
| 117 | |
| 118 | // Returns the IPv6 address of the container, or `None()` if no |
| 119 | // IPv6 address has been assigned. |
| 120 | const Option<std::string> ip6Address; |
| 121 | |
| 122 | const std::vector<Device> devices; |
| 123 | |
| 124 | // Returns the DNS nameservers set by "--dns" option. |
| 125 | const std::vector<std::string> dns; |
| 126 | |
| 127 | // Returns the DNS options set by "--dns-option" option. |
| 128 | const std::vector<std::string> dnsOptions; |
| 129 | |
| 130 | // Returns the DNS search domains set by "--dns-search" option. |
| 131 | const std::vector<std::string> dnsSearch; |
| 132 | |
| 133 | private: |
| 134 | Container( |
| 135 | const std::string& _output, |
| 136 | const std::string& _id, |
| 137 | const std::string& _name, |
| 138 | const Option<pid_t>& _pid, |
| 139 | bool _started, |
| 140 | const Option<std::string>& _ipAddress, |
| 141 | const Option<std::string>& _ip6Address, |
| 142 | const std::vector<Device>& _devices, |
| 143 | const std::vector<std::string>& _dns, |
| 144 | const std::vector<std::string>& _dnsOptions, |
| 145 | const std::vector<std::string>& _dnsSearch) |
| 146 | : output(_output), |
| 147 | id(_id), |
| 148 | name(_name), |