Skip to content

A modern Java client for Docker: fluent API, test-friendly, cross-platform

License

Notifications You must be signed in to change notification settings

cowwoc/anchor4j

Repository files navigation

Maven Central build-status

logo Anchor4J

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.anchor4j</groupId>
  <artifactId>anchor4j</artifactId>
  <version>0.10</version>
</dependency>

Example

import client.io.github.cowwoc.anchor4j.docker.Docker;

import java.io.IOException;

class Example
{
  public static void main(String[] args)
    throws IOException, InterruptedException
  {
    Docker docker = Docker.connect();

    String imageId = docker.buildImage().
      export(Exporter.dockerImage().build()).
      build(".");

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

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 anchor4j 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

The modules are 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, cross-platform

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages