Skip to content

Commit 9aa7c50

Browse files
committed
Add ping method
1 parent 3d84b5b commit 9aa7c50

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/com/kpelykh/docker/client/DockerClient.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
/**

0 commit comments

Comments
 (0)