@@ -190,6 +190,19 @@ public Version version() throws DockerException {
190190 }
191191 }
192192 }
193+
194+
195+ public int ping () throws DockerException {
196+ WebResource webResource = client .resource (restEndpointUrl + "/_ping" );
197+
198+ try {
199+ LOGGER .trace ("GET: {}" , webResource );
200+ ClientResponse resp = webResource .get (ClientResponse .class );
201+ return resp .getStatus ();
202+ } catch (UniformInterfaceException exception ) {
203+ throw new DockerException (exception );
204+ }
205+ }
193206
194207
195208 /**
@@ -280,6 +293,36 @@ private String name(String name) {
280293 return name .contains ("/" ) ? name : authConfig .getUsername ();
281294 }
282295
296+ /**
297+ * Tag an image into a repository
298+ *
299+ * @param image the local image to tag (either a name or an id)
300+ * @param repository the repository to tag in
301+ * @param tag any tag for this image
302+ * @param force (not documented)
303+ * @return the HTTP status code (201 for success)
304+ */
305+ public int tag (String image , String repository , String tag , boolean force ) throws DockerException {
306+ Preconditions .checkNotNull (image , "image was not specified" );
307+ Preconditions .checkNotNull (repository , "repository was not specified" );
308+ Preconditions .checkNotNull (tag , " tag was not provided" );
309+
310+ MultivaluedMap <String , String > params = new MultivaluedMapImpl ();
311+ params .add ("repo" , repository );
312+ params .add ("tag" , tag );
313+ params .add ("force" , String .valueOf (force ));
314+
315+ WebResource webResource = client .resource (restEndpointUrl + "/images/" + image + "/tag" ).queryParams (params );
316+
317+ try {
318+ LOGGER .trace ("POST: {}" , webResource );
319+ ClientResponse resp = webResource .post (ClientResponse .class );
320+ return resp .getStatus ();
321+ } catch (UniformInterfaceException exception ) {
322+ throw new DockerException (exception );
323+ }
324+ }
325+
283326 /**
284327 * Create an image by importing the given stream of a tar file.
285328 *
0 commit comments