@@ -88,6 +88,19 @@ public function containerList($all = false, $size = false)
8888 return $ this ->browser ->get ($ this ->url ('/containers/json?all=%u&size=%u ' , $ all , $ size ))->then (array ($ this ->parser , 'expectJson ' ));
8989 }
9090
91+ /**
92+ * Create a container
93+ *
94+ * @param array $config e.g. `array('Image' => 'busybox', 'Cmd' => 'date')` (see link)
95+ * @param string|null $name (optional) name to assign to this container
96+ * @return Promise Promise<array> container properties `array('Id' => $containerId', 'Warnings' => array())`
97+ * @link https://docs.docker.com/reference/api/docker_remote_api_v1.15/#create-a-container
98+ */
99+ public function containerCreate ($ config , $ name = null )
100+ {
101+ return $ this ->postJson ($ this ->url ('/containers/create?name=%s ' , $ name ), $ config )->then (array ($ this ->parser , 'expectJson ' ));
102+ }
103+
91104 /**
92105 * Return low-level information on the container id
93106 *
@@ -126,6 +139,19 @@ public function containerResize($container, $w, $h)
126139 return $ this ->browser ->get ($ this ->url ('/containers/%s/resize?w=%u&h=%u ' , $ container , $ w , $ h ))->then (array ($ this ->parser , 'expectEmpty ' ));
127140 }
128141
142+ /**
143+ * Start the container id
144+ *
145+ * @param string $container container ID
146+ * @param array $config (optional) start config (see link)
147+ * @return Promise Promise<null>
148+ * @link https://docs.docker.com/reference/api/docker_remote_api_v1.15/#start-a-container
149+ */
150+ public function containerStart ($ container , $ config = array ())
151+ {
152+ return $ this ->postJson ($ this ->url ('/containers/%s/start ' , $ container ), $ config )->then (array ($ this ->parser , 'expectEmpty ' ));
153+ }
154+
129155 /**
130156 * Stop the container id
131157 *
0 commit comments