Docker Java API

Elegant OOP wrapper over Docker's API

License

License

Categories

Categories

Java Languages Docker Container Virtualization Tools
GroupId

GroupId

com.amihaiemil.web
ArtifactId

ArtifactId

docker-java-api
Last Version

Last Version

0.0.13
Release Date

Release Date

Type

Type

jar
Description

Description

Docker Java API
Elegant OOP wrapper over Docker's API
Project URL

Project URL

https://www.github.com/amihaiemil/docker-java-api
Source Code Management

Source Code Management

https://github.com/amihaiemil/docker-java-api

Download docker-java-api

How to add to project

<!-- https://jarcasting.com/artifacts/com.amihaiemil.web/docker-java-api/ -->
<dependency>
    <groupId>com.amihaiemil.web</groupId>
    <artifactId>docker-java-api</artifactId>
    <version>0.0.13</version>
</dependency>
// https://jarcasting.com/artifacts/com.amihaiemil.web/docker-java-api/
implementation 'com.amihaiemil.web:docker-java-api:0.0.13'
// https://jarcasting.com/artifacts/com.amihaiemil.web/docker-java-api/
implementation ("com.amihaiemil.web:docker-java-api:0.0.13")
'com.amihaiemil.web:docker-java-api:jar:0.0.13'
<dependency org="com.amihaiemil.web" name="docker-java-api" rev="0.0.13">
  <artifact name="docker-java-api" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.amihaiemil.web', module='docker-java-api', version='0.0.13')
)
libraryDependencies += "com.amihaiemil.web" % "docker-java-api" % "0.0.13"
[com.amihaiemil.web/docker-java-api "0.0.13"]

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.httpcomponents : httpclient jar 4.5.5
com.github.jnr : jnr-unixsocket jar 0.18

provided (1)

Group / Artifact Type Version
javax.json : javax.json-api jar 1.0

test (6)

Group / Artifact Type Version
org.glassfish : javax.json jar 1.0.4
org.hamcrest : hamcrest-all jar 1.3
junit : junit jar 4.12
org.mockito : mockito-all jar 1.9.5
com.sun.grizzly : grizzly-servlet-webserver jar 1.9.64
org.apache.commons : commons-io jar 1.3.2

Project Modules

There are no modules declared in this project.

docker-java-api

Managed by Zerocrat

Build Status Coverage Status Hits-of-Code

Donate via Zerocracy DevOps By Rultor.com We recommend IntelliJ IDEA

Lightweight, object-oriented, Docker client for Java

A Java library for the Docker Engine API. It is the equivalent of the docker 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. Read this blog post and the 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 of JSON-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, go here.

If you are not using Maven, you can also download the fat 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:

final Container started = new UnixDocker(new File("/var/run/docker.sock"))
    .images()
    .pull("hello-world", "latest")
    .run();

or, the same code snippet, less fluent:

final Docker docker = new UnixDocker(new File("/var/run/docker.sock"));
final Images images = docker.images();
for(final Image image : images){
//iterate over the existing images
}
final Image helloWorld = images.pull("hello-world", "latest");
final Container started = helloWorld.run();

More info in the Wiki.

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 sure you're following our code style and guidlines.

Running Integration Tests

In order to run the integration tests add the itcases 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

Versions

Version
0.0.13
0.0.12
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1