@Test @Ignore("Need a running Docker daemon") public void testSearchImages() throws Exception { List<ImageSearch> images = dockerClient.search("karaf"); for (ImageSearch image : images) { System.out.println("----"); System.out.println("Image Name: " + image.getName()); System.out.println("Image Star Count: " + image.getStarCount()); System.out.println("Image Automated: " + image.isAutomated()); System.out.println("Image Official: " + image.isOfficial()); System.out.println("Image Description: " + image.getDescription()); } }
public List<ImageSearch> search(String term) throws Exception { URL dockerUrl = new URL(this.url + "/images/search?term=" + term); HttpURLConnection connection = (HttpURLConnection) dockerUrl.openConnection(); connection.setRequestMethod("GET"); List<ImageSearch> images = mapper.readValue(connection.getInputStream(), new TypeReference<List<ImageSearch>>(){}); return images; }
DockerClient { public List<ImageSearch> search(String term) throws Exception { URL dockerUrl = new URL(this.url + "/images/search?term=" + term); HttpURLConnection connection = (HttpURLConnection) dockerUrl.openConnection(); connection.setRequestMethod("GET"); List<ImageSearch> images = mapper.readValue(connection.getInputStream(), new TypeReference<List<ImageSearch>>(){}); return images; } }
DockerClient { public List<ImageSearch> search(String term) throws Exception { URL dockerUrl = new URL(this.url + "/images/search?term=" + term); HttpURLConnection connection = (HttpURLConnection) dockerUrl.openConnection(); connection.setRequestMethod("GET"); List<ImageSearch> images = mapper.readValue(connection.getInputStream(), new TypeReference<List<ImageSearch>>(){}); return images; } DockerClient(String url); }
DockerClient { public List<ImageSearch> search(String term) throws Exception { URL dockerUrl = new URL(this.url + "/images/search?term=" + term); HttpURLConnection connection = (HttpURLConnection) dockerUrl.openConnection(); connection.setRequestMethod("GET"); List<ImageSearch> images = mapper.readValue(connection.getInputStream(), new TypeReference<List<ImageSearch>>(){}); return images; } DockerClient(String url); Info info(); Version version(); List<Container> ps(boolean showAll); Container inspect(String id); Top top(String id); void create(ContainerConfig config, String name); void rm(String id, boolean removeVolumes, boolean force); void start(String id); void stop(String id, int timeToWait); void restart(String id, int timeToWait); void kill(String id, String signal); void rename(String id, String name); void pause(String id); void unpause(String id); String logs(String id, boolean stdout, boolean stderr, boolean timestamps, boolean details); void commit(String container, ContainerConfig config, String message, String repo, String tag); List<Image> images(boolean showAll); void pull(String name, String tag, boolean verbose); void push(String name, String tag, boolean verbose); void tag(String name, String repo, String tag); void rmi(String name, boolean force, boolean noprune); List<ImageSearch> search(String term); Image getImage(String name); List<ImageHistory> history(String name); }
DockerClient { public List<ImageSearch> search(String term) throws Exception { URL dockerUrl = new URL(this.url + "/images/search?term=" + term); HttpURLConnection connection = (HttpURLConnection) dockerUrl.openConnection(); connection.setRequestMethod("GET"); List<ImageSearch> images = mapper.readValue(connection.getInputStream(), new TypeReference<List<ImageSearch>>(){}); return images; } DockerClient(String url); Info info(); Version version(); List<Container> ps(boolean showAll); Container inspect(String id); Top top(String id); void create(ContainerConfig config, String name); void rm(String id, boolean removeVolumes, boolean force); void start(String id); void stop(String id, int timeToWait); void restart(String id, int timeToWait); void kill(String id, String signal); void rename(String id, String name); void pause(String id); void unpause(String id); String logs(String id, boolean stdout, boolean stderr, boolean timestamps, boolean details); void commit(String container, ContainerConfig config, String message, String repo, String tag); List<Image> images(boolean showAll); void pull(String name, String tag, boolean verbose); void push(String name, String tag, boolean verbose); void tag(String name, String repo, String tag); void rmi(String name, boolean force, boolean noprune); List<ImageSearch> search(String term); Image getImage(String name); List<ImageHistory> history(String name); static final String DEFAULT_URL; }