Skip to content

A modern Java client for Docker: fluent API, test-friendly, and Kubernetes-ready.

License

Notifications You must be signed in to change notification settings

cowwoc/canister

Repository files navigation

Maven Central build-status

logo Canister

API Changelog

A modern Java client for Docker: fluent API, test-friendly, and Kubernetes-ready.

✅ A fluent, strongly typed API.
✅ Support for building images with and without root access.
✅ Easy integration with CI and tests.
✅ First-class support for capturing stdout/stderr and process exit status.

To get started, add this Maven dependency:

<dependency>
  <groupId>io.github.cowwoc.canister</groupId>
  <artifactId>canister</artifactId>
  <version>0.10</version>
</dependency>

Example

import io.github.cowwoc.canister.core.id.ImageId;
import io.github.cowwoc.canister.core.resource.ImageBuilder.Exporter;
import io.github.cowwoc.canister.docker.api.client.Docker;
import io.github.cowwoc.canister.docker.api.client.DockerClient;

import java.io.IOException;

class Example
{
	public static void main(String[] args) throws IOException, InterruptedException
	{
		try (DockerClient docker = Docker.fromPath())
		{
			ImageId id = docker.buildImage().
				export(Exporter.dockerImage().build()).
				apply(".");

			docker.tagImage(id, "rocket-ship");
			docker.pushImage("rocket-ship").apply();
		}
	}
}

Getting Started

See the API documentation for more details.

💖 Support Ongoing Development 💖

If you find this project helpful, please consider sponsoring me. Maintaining quality open-source software takes significant time and effort—especially while balancing family life with young children. Your support helps make this work sustainable.

Missing Features?

The canister API covers a wide range of functionality, and since my time is limited, new features are added based on user requests. If there's a property or capability you'd like to see added, please open a new issue.

Licensing

This library is dual-licensed:

  • ModernJDK License (free for personal use or small businesses):

    • You may use, modify, and redistribute this software for free when:
      • It is compiled for and executed on the latest generally available (GA) Java Development Kit (JDK) version at the time of deployment.
      • You are an individual or a company with 10 or fewer employees.
      • You do not rebrand or white-label the software.
    • You are not required to update existing deployments when a newer JDK is released.
  • 💼 Commercial License:

    • Required for:
      • Compiling, running, or distributing the software for older (non-GA) JDK versions.
      • Use by companies with more than 10 employees.
      • White-labeling or rebranding the library in any form.

Dependencies

About

A modern Java client for Docker: fluent API, test-friendly, and Kubernetes-ready.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages