Skip to content

Commit c7fb14a

Browse files
committed
Add Javadoc to commands and adjust CI steps
1 parent c851b82 commit c7fb14a

20 files changed

+125
-2
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: ./gradlew test --tests "io.github.intisy.docker.ModelTest" --tests "io.github.intisy.docker.DockerClientBuilderTest" --info
3636
shell: bash
3737

38-
- name: Run tests (Linux - excluding daemon startup tests)
38+
- name: Run tests
3939
if: matrix.test-type == 'integration'
4040
run: ./gradlew test --tests "io.github.intisy.docker.ModelTest" --tests "io.github.intisy.docker.DockerClientBuilderTest" --tests "io.github.intisy.docker.WslDiagnosticTest" --info
4141
shell: bash
@@ -62,7 +62,7 @@ jobs:
6262
- name: Grant execute permission for gradlew
6363
run: chmod +x gradlew
6464

65-
- name: Run build with Gradle Wrapper (skip tests - already run in test job)
65+
- name: Run build with Gradle Wrapper
6666
run: ./gradlew build -x test -Partifact_version=${{ github.ref_name }}
6767

6868
- name: Create Release and Upload Jar

src/main/java/io/github/intisy/docker/DockerClient.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@
2121
* .withHost("unix:///var/run/docker.sock")
2222
* .build();
2323
*
24+
* // List containers
25+
* List<Container> containers = client.listContainers().withShowAll(true).exec();
26+
*
27+
* // Pull and run a container
28+
* client.pullImage("nginx:alpine").exec(5, TimeUnit.MINUTES);
29+
* CreateContainerResponse response = client.createContainer("nginx:alpine")
30+
* .withName("my-nginx")
31+
* .exec();
32+
* client.startContainer(response.getId()).exec();
33+
*
34+
* // Clean up
35+
* client.stopContainer(response.getId()).exec();
36+
* client.removeContainer(response.getId()).exec();
37+
* }</pre>
38+
*
2439
* @author Finn Birich
2540
*/
2641
public class DockerClient implements Closeable {

src/main/java/io/github/intisy/docker/DockerProvider.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,20 @@ public static DockerProvider get() {
113113
* Start the Docker daemon.
114114
* This will always start a new managed Docker daemon instance.
115115
* The daemon will use isolated paths to avoid conflicts with Docker Desktop or other instances.
116+
*
117+
* @throws IOException if an I/O error occurs during startup
118+
* @throws InterruptedException if the thread is interrupted during startup
119+
* @throws IOException if an I/O error occurs during startup
120+
* @throws InterruptedException if the thread is interrupted during startup
116121
*/
117122
public abstract void start() throws IOException, InterruptedException;
118123

119124
/**
120125
* Get a DockerClient for interacting with the Docker daemon.
121126
* The client can be used to manage containers, images, volumes, networks, etc.
127+
*
128+
* @return the DockerClient instance
129+
* @return the DockerClient instance
122130
*/
123131
public abstract DockerClient getClient();
124132

@@ -131,6 +139,9 @@ public static DockerProvider get() {
131139
/**
132140
* Ensure Docker is installed.
133141
* Downloads and installs Docker if necessary.
142+
*
143+
* @throws IOException if an I/O error occurs during installation
144+
* @throws IOException if an I/O error occurs during installation
134145
*/
135146
public abstract void ensureInstalled() throws IOException;
136147

src/main/java/io/github/intisy/docker/command/container/CreateContainerCmd.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ public CreateContainerCmd withBind(String hostPath, String containerPath) {
136136

137137
/**
138138
* Add a bind mount with read-only option.
139+
*
140+
* @param hostPath the host path to mount
141+
* @param containerPath the container path to mount to
142+
* @param readOnly whether the mount should be read-only
143+
* @return this command instance
139144
*/
140145
public CreateContainerCmd withBind(String hostPath, String containerPath, boolean readOnly) {
141146
if (config.getHostConfig() == null) {
@@ -191,6 +196,9 @@ public CreateContainerCmd withRestartPolicy(HostConfig.RestartPolicy restartPoli
191196

192197
/**
193198
* Set memory limit in bytes.
199+
*
200+
* @param memory the memory limit in bytes
201+
* @return this command instance
194202
*/
195203
public CreateContainerCmd withMemory(long memory) {
196204
if (config.getHostConfig() == null) {

src/main/java/io/github/intisy/docker/command/container/ExecStartCmd.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public void exec() {
5858

5959
/**
6060
* Execute the command and stream output.
61+
*
62+
* @param callback the callback for streaming output
6163
*/
6264
public void exec(StreamCallback<String> callback) {
6365
try {

src/main/java/io/github/intisy/docker/command/container/KillContainerCmd.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public KillContainerCmd(DockerHttpClient client, String containerId) {
2424

2525
/**
2626
* Set the signal to send (default: SIGKILL).
27+
*
28+
* @param signal the signal to send (e.g. SIGTERM)
29+
* @return this command instance
2730
*/
2831
public KillContainerCmd withSignal(String signal) {
2932
this.signal = signal;

src/main/java/io/github/intisy/docker/command/container/ListContainersCmd.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public ListContainersCmd(DockerHttpClient client) {
2828

2929
/**
3030
* Show all containers (default shows just running).
31+
*
32+
* @param showAll true to show all containers, false for running only
33+
* @return this command instance
3134
*/
3235
public ListContainersCmd withShowAll(boolean showAll) {
3336
this.showAll = showAll;
@@ -54,6 +57,9 @@ public ListContainersCmd withFilter(String key, String... values) {
5457

5558
/**
5659
* Filter by status (created, restarting, running, removing, paused, exited, dead).
60+
*
61+
* @param status the status to filter by
62+
* @return this command instance
5763
*/
5864
public ListContainersCmd withStatusFilter(String status) {
5965
return withFilter("status", status);

src/main/java/io/github/intisy/docker/command/container/LogsContainerCmd.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public LogsContainerCmd(DockerHttpClient client, String containerId) {
3131

3232
/**
3333
* Follow log output (streaming).
34+
*
35+
* @param follow true to follow log output
36+
* @return this command instance
3437
*/
3538
public LogsContainerCmd withFollow(boolean follow) {
3639
this.follow = follow;
@@ -49,6 +52,9 @@ public LogsContainerCmd withStderr(boolean stderr) {
4952

5053
/**
5154
* Show logs since timestamp (Unix timestamp or RFC3339).
55+
*
56+
* @param since the start timestamp
57+
* @return this command instance
5258
*/
5359
public LogsContainerCmd withSince(String since) {
5460
this.since = since;
@@ -57,6 +63,9 @@ public LogsContainerCmd withSince(String since) {
5763

5864
/**
5965
* Show logs until timestamp (Unix timestamp or RFC3339).
66+
*
67+
* @param until the end timestamp
68+
* @return this command instance
6069
*/
6170
public LogsContainerCmd withUntil(String until) {
6271
this.until = until;
@@ -70,6 +79,9 @@ public LogsContainerCmd withTimestamps(boolean timestamps) {
7079

7180
/**
7281
* Only return the last N lines.
82+
*
83+
* @param tail the number of lines to return
84+
* @return this command instance
7385
*/
7486
public LogsContainerCmd withTail(int tail) {
7587
this.tail = tail;
@@ -78,6 +90,8 @@ public LogsContainerCmd withTail(int tail) {
7890

7991
/**
8092
* Execute the command and return logs as a string.
93+
*
94+
* @return the log output as a string
8195
*/
8296
public String exec() {
8397
try {
@@ -101,6 +115,8 @@ public String exec() {
101115

102116
/**
103117
* Execute the command with streaming callback.
118+
*
119+
* @param callback the callback for streaming log lines
104120
*/
105121
public void exec(StreamCallback<String> callback) {
106122
try {

src/main/java/io/github/intisy/docker/command/container/RestartContainerCmd.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public RestartContainerCmd(DockerHttpClient client, String containerId) {
2424

2525
/**
2626
* Set timeout in seconds before killing the container.
27+
*
28+
* @param timeout seconds to wait before killing
29+
* @return this command instance
2730
*/
2831
public RestartContainerCmd withTimeout(int timeout) {
2932
this.timeout = timeout;

src/main/java/io/github/intisy/docker/command/container/StopContainerCmd.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public StopContainerCmd(DockerHttpClient client, String containerId) {
2525

2626
/**
2727
* Set timeout in seconds before killing the container.
28+
*
29+
* @param timeout seconds to wait before killing
30+
* @return this command instance
2831
*/
2932
public StopContainerCmd withTimeout(int timeout) {
3033
this.timeout = timeout;

0 commit comments

Comments
 (0)