Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Lightweight Java Docker client

License

NotificationsYou must be signed in to change notification settings

amihaiemil/docker-java-api

Repository files navigation

Managed by Zerocrat

Build StatusCoverage StatusHits-of-Code

Donate via ZerocracyDevOps By Rultor.comWe recommend IntelliJ IDEA

Lightweight, object-oriented, Docker client for Java

A Java library for the Docker Engine API. It is the equivalent of thedocker command-line client, for Java applications.

Unlike other docker clients for Java, this one aims to be as lightweight as possible, with as few transitive dependencies as possible and it should cause absolutely no runtime conflicts with other frameworks or platforms like Java EE.

Another target is that this library should be a true API, not an SDK. Readthis blog post andthe wiki for more details.

Maven dependency

The library comes as a maven dependency:

<dependency>    <groupId>com.amihaiemil.web</groupId>    <artifactId>docker-java-api</artifactId>    <version>0.0.13</version></dependency>

In order for it to work, you need to have an implementation ofJSON-P (JSR 374) in your classpath (it doesn't come transitively since most people are using Java EE APIs so, chances are it is already provided!). If you have no idea what this means, gohere.

If you are not using Maven, you can also download thefat jar.

Usage Example And Wiki

Here is all you need to do in order to pull an Image and run a Container into the local Docker engine:

finalContainerstarted =newUnixDocker(newFile("/var/run/docker.sock"))    .images()    .pull("hello-world","latest")    .run();

or, the same code snippet, less fluent:

finalDockerdocker =newUnixDocker(newFile("/var/run/docker.sock"));finalImagesimages =docker.images();for(finalImageimage :images){//iterate over the existing images}finalImagehelloWorld =images.pull("hello-world","latest");finalContainerstarted =helloWorld.run();

More info in theWiki.

Contributing

If you would like to contribute, just open an issue or a PR.

Make sure the maven build:

$mvn clean install -Pcheckstyle

passes before making a PR.Checkstyle will make sureyou're following our code style and guidlines.

Running Integration Tests

In order to run the integration tests add theitcases profile to the maven command:

$mvn clean install -Pcheckstyle -Pitcases

Docker has to be installed and the ubuntu:latest image should be pulled on the machine, with the default configuration, in order for the IT cases to work.

Stargazers over time

Stargazers over time

About

Lightweight Java Docker client

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors12


[8]ページ先頭

©2009-2025 Movatter.jp