Skip to content

pod4dev/libpod-java

Repository files navigation

libpod-java

supports a RESTful API for the Libpod library

  • API version: 5.0.0
    • Generator version: 7.9.0

This documentation describes the Podman v2.x+ RESTful API. It consists of a Docker-compatible API and a Libpod API providing support for Podman’s unique features such as pods.

To start the service and keep it running for 5,000 seconds (-t 0 runs forever):

podman system service -t 5000 &

You can then use cURL on the socket using requests documented below.

NOTE: if you install the package podman-docker, it will create a symbolic link for /run/docker.sock to /run/podman/podman.sock

NOTE: Some fields in the API response JSON are encoded as omitempty, which means that if said field has a zero value, they will not be encoded in the API response. This is a feature to help reduce the size of the JSON responses returned via the API.

NOTE: Due to the limitations of go-swagger, some field values that have a complex type show up as null in the docs as well as in the API responses. This is because the zero value for the field type is null. The field description in the docs will state what type the field is expected to be for such cases.

See podman-system-service(1) for more information.

Quick Examples:

'podman info'

curl --unix-socket /run/podman/podman.sock http://d/v5.0.0/libpod/info

'podman pull quay.io/containers/podman'

curl -XPOST --unix-socket /run/podman/podman.sock -v 'http://d/v5.0.0/images/create?fromImage=quay.io%2Fcontainers%2Fpodman'

'podman list images'

curl --unix-socket /run/podman/podman.sock -v 'http://d/v5.0.0/libpod/images/json' | jq

For more information, please visit https://podman.io/community/

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>io.github.pod4dev</groupId>
  <artifactId>libpod-java</artifactId>
  <version>5.4.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
    mavenCentral()     // Needed if the 'libpod-java' jar has been published to maven central.
    mavenLocal()       // Needed if the 'libpod-java' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "io.github.pod4dev:libpod-java:5.4.0"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/libpod-java-5.4.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

// Import classes:
import io.github.pod4dev.libpodj.ApiClient;
import io.github.pod4dev.libpodj.ApiException;
import io.github.pod4dev.libpodj.Configuration;
import io.github.pod4dev.libpodj.model.*;
import io.github.pod4dev.libpodj.api.ContainersApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://podman.io");

    ContainersApi apiInstance = new ContainersApi(defaultClient);
    String name = "name_example"; // String | the name or ID of the container
    String detachKeys = "detachKeys_example"; // String | keys to use for detaching from the container
    Boolean logs = true; // Boolean | Stream all logs from the container across the connection. Happens before streaming attach (if requested). At least one of logs or stream must be set
    Boolean stream = true; // Boolean | Attach to the container. If unset, and logs is set, only the container's logs will be sent. At least one of stream or logs must be set
    Boolean stdout = true; // Boolean | Attach to container STDOUT
    Boolean stderr = true; // Boolean | Attach to container STDERR
    Boolean stdin = true; // Boolean | Attach to container STDIN
    try {
      apiInstance.containerAttachLibpod(name)
            .detachKeys(detachKeys)
            .logs(logs)
            .stream(stream)
            .stdout(stdout)
            .stderr(stderr)
            .stdin(stdin)
            .execute();
    } catch (ApiException e) {
      System.err.println("Exception when calling ContainersApi#containerAttachLibpod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Documentation for API Endpoints

All URIs are relative to http://podman.io

Class Method HTTP request Description
ContainersApi containerAttachLibpod POST /libpod/containers/{name}/attach Attach to a container
ContainersApi containerChangesLibpod GET /libpod/containers/{name}/changes Report on changes to container's filesystem; adds, deletes or modifications.
ContainersApi containerCheckpointLibpod POST /libpod/containers/{name}/checkpoint Checkpoint a container
ContainersApi containerCreateLibpod POST /libpod/containers/create Create a container
ContainersApi containerDeleteLibpod DELETE /libpod/containers/{name} Delete container
ContainersApi containerExistsLibpod GET /libpod/containers/{name}/exists Check if container exists
ContainersApi containerExportLibpod GET /libpod/containers/{name}/export Export a container
ContainersApi containerHealthcheckLibpod GET /libpod/containers/{name}/healthcheck Run a container's healthcheck
ContainersApi containerInitLibpod POST /libpod/containers/{name}/init Initialize a container
ContainersApi containerInspectLibpod GET /libpod/containers/{name}/json Inspect container
ContainersApi containerKillLibpod POST /libpod/containers/{name}/kill Kill container
ContainersApi containerListLibpod GET /libpod/containers/json List containers
ContainersApi containerLogsLibpod GET /libpod/containers/{name}/logs Get container logs
ContainersApi containerMountLibpod POST /libpod/containers/{name}/mount Mount a container
ContainersApi containerPauseLibpod POST /libpod/containers/{name}/pause Pause a container
ContainersApi containerPruneLibpod POST /libpod/containers/prune Delete stopped containers
ContainersApi containerRenameLibpod POST /libpod/containers/{name}/rename Rename an existing container
ContainersApi containerResizeLibpod POST /libpod/containers/{name}/resize Resize a container's TTY
ContainersApi containerRestartLibpod POST /libpod/containers/{name}/restart Restart a container
ContainersApi containerRestoreLibpod POST /libpod/containers/{name}/restore Restore a container
ContainersApi containerShowMountedLibpod GET /libpod/containers/showmounted Show mounted containers
ContainersApi containerStartLibpod POST /libpod/containers/{name}/start Start a container
ContainersApi containerStatsLibpod GET /libpod/containers/{name}/stats Get stats for a container
ContainersApi containerStopLibpod POST /libpod/containers/{name}/stop Stop a container
ContainersApi containerTopLibpod GET /libpod/containers/{name}/top List processes
ContainersApi containerUnmountLibpod POST /libpod/containers/{name}/unmount Unmount a container
ContainersApi containerUnpauseLibpod POST /libpod/containers/{name}/unpause Unpause Container
ContainersApi containerUpdateLibpod POST /libpod/containers/{name}/update Updates the configuration of an existing container, allowing changes to resource limits and healthchecks
ContainersApi containerWaitLibpod POST /libpod/containers/{name}/wait Wait on a container
ContainersApi containersStatsAllLibpod GET /libpod/containers/stats Get stats for one or more containers
ContainersApi generateKubeLibpod GET /libpod/generate/kube Generate a Kubernetes YAML file.
ContainersApi generateSystemdLibpod GET /libpod/generate/{name}/systemd Generate Systemd Units
ContainersApi imageCommitLibpod POST /libpod/commit Commit
ContainersApi kubeApplyLibpod POST /libpod/kube/apply Apply a podman workload or Kubernetes YAML file.
ContainersApi playKubeDownLibpod DELETE /libpod/play/kube Remove resources created from kube play
ContainersApi playKubeLibpod POST /libpod/play/kube Play a Kubernetes YAML file.
ContainersApi putContainerArchiveLibpod PUT /libpod/containers/{name}/archive Copy files into a container
ContainersCompatApi containerArchive GET /containers/{name}/archive Get files from a container
ContainersCompatApi containerArchiveLibpod GET /libpod/containers/{name}/archive Copy files from a container
ContainersCompatApi containerAttach POST /containers/{name}/attach Attach to a container
ContainersCompatApi containerChangesLibpod_0 GET /libpod/containers/{name}/changes Report on changes to container's filesystem; adds, deletes or modifications.
ContainersCompatApi containerCreate POST /containers/create Create a container
ContainersCompatApi containerDelete DELETE /containers/{name} Remove a container
ContainersCompatApi containerExport GET /containers/{name}/export Export a container
ContainersCompatApi containerInspect GET /containers/{name}/json Inspect container
ContainersCompatApi containerKill POST /containers/{name}/kill Kill container
ContainersCompatApi containerList GET /containers/json List containers
ContainersCompatApi containerLogs GET /containers/{name}/logs Get container logs
ContainersCompatApi containerPause POST /containers/{name}/pause Pause container
ContainersCompatApi containerPrune POST /containers/prune Delete stopped containers
ContainersCompatApi containerRename POST /containers/{name}/rename Rename an existing container
ContainersCompatApi containerResize POST /containers/{name}/resize Resize a container's TTY
ContainersCompatApi containerRestart POST /containers/{name}/restart Restart container
ContainersCompatApi containerStart POST /containers/{name}/start Start a container
ContainersCompatApi containerStats GET /containers/{name}/stats Get stats for a container
ContainersCompatApi containerStop POST /containers/{name}/stop Stop a container
ContainersCompatApi containerTop GET /containers/{name}/top List processes running inside a container
ContainersCompatApi containerUnpause POST /containers/{name}/unpause Unpause container
ContainersCompatApi containerUpdate POST /containers/{name}/update Update configuration of an existing container
ContainersCompatApi containerWait POST /containers/{name}/wait Wait on a container
ContainersCompatApi imageCommit POST /commit New Image
ContainersCompatApi putContainerArchive PUT /containers/{name}/archive Put files into a container
ExecApi containerExecLibpod POST /libpod/containers/{name}/exec Create an exec instance
ExecApi execInspectLibpod GET /libpod/exec/{id}/json Inspect an exec instance
ExecApi execResizeLibpod POST /libpod/exec/{id}/resize Resize an exec instance
ExecApi execStartLibpod POST /libpod/exec/{id}/start Start an exec instance
ExecCompatApi containerExec POST /containers/{name}/exec Create an exec instance
ExecCompatApi execInspect GET /exec/{id}/json Inspect an exec instance
ExecCompatApi execResize POST /exec/{id}/resize Resize an exec instance
ExecCompatApi execStart POST /exec/{id}/start Start an exec instance
ImagesApi imageBuildLibpod POST /libpod/build Create image
ImagesApi imageChangesLibpod GET /libpod/images/{name}/changes Report on changes to images's filesystem; adds, deletes or modifications.
ImagesApi imageDeleteAllLibpod DELETE /libpod/images/remove Remove one or more images from the storage.
ImagesApi imageDeleteLibpod DELETE /libpod/images/{name} Remove an image from the local storage.
ImagesApi imageExistsLibpod GET /libpod/images/{name}/exists Image exists
ImagesApi imageExportLibpod GET /libpod/images/export Export multiple images
ImagesApi imageGetLibpod GET /libpod/images/{name}/get Export an image
ImagesApi imageHistoryLibpod GET /libpod/images/{name}/history History of an image
ImagesApi imageImportLibpod POST /libpod/images/import Import image
ImagesApi imageInspectLibpod GET /libpod/images/{name}/json Inspect an image
ImagesApi imageListLibpod GET /libpod/images/json List Images
ImagesApi imageLoadLibpod POST /libpod/images/load Load image
ImagesApi imagePruneLibpod POST /libpod/images/prune Prune unused images
ImagesApi imagePullLibpod POST /libpod/images/pull Pull images
ImagesApi imagePushLibpod POST /libpod/images/{name}/push Push Image
ImagesApi imageResolveLibpod GET /libpod/images/{name}/resolve Resolve an image (short) name
ImagesApi imageScpLibpod POST /libpod/images/scp/{name} Copy an image from one host to another
ImagesApi imageSearchLibpod GET /libpod/images/search Search images
ImagesApi imageTagLibpod POST /libpod/images/{name}/tag Tag an image
ImagesApi imageTreeLibpod GET /libpod/images/{name}/tree Image tree
ImagesApi imageUntagLibpod POST /libpod/images/{name}/untag Untag an image
ImagesCompatApi imageBuild POST /build Create image
ImagesCompatApi imageCreate POST /images/create Create an image
ImagesCompatApi imageDelete DELETE /images/{name} Remove Image
ImagesCompatApi imageGet GET /images/{name}/get Export an image
ImagesCompatApi imageGetAll GET /images/get Export several images
ImagesCompatApi imageHistory GET /images/{name}/history History of an image
ImagesCompatApi imageInspect GET /images/{name}/json Inspect an image
ImagesCompatApi imageList GET /images/json List Images
ImagesCompatApi imageLoad POST /images/load Import image
ImagesCompatApi imagePrune POST /images/prune Prune unused images
ImagesCompatApi imagePush POST /images/{name}/push Push Image
ImagesCompatApi imageSearch GET /images/search Search images
ImagesCompatApi imageTag POST /images/{name}/tag Tag an image
ManifestsApi manifestAddLibpod POST /libpod/manifests/{name}/add Add image
ManifestsApi manifestCreateLibpod POST /libpod/manifests/{name} Create
ManifestsApi manifestDeleteLibpod DELETE /libpod/manifests/{name} Delete manifest list
ManifestsApi manifestExistsLibpod GET /libpod/manifests/{name}/exists Exists
ManifestsApi manifestInspectLibpod GET /libpod/manifests/{name}/json Inspect
ManifestsApi manifestModifyLibpod PUT /libpod/manifests/{name} Modify manifest list
ManifestsApi manifestPushLibpod POST /libpod/manifests/{name}/registry/{destination} Push manifest list to registry
ManifestsApi manifestPushV3Libpod POST /libpod/manifests/{name}/push Push manifest to registry
NetworksApi networkConnectLibpod POST /libpod/networks/{name}/connect Connect container to network
NetworksApi networkCreateLibpod POST /libpod/networks/create Create network
NetworksApi networkDeleteLibpod DELETE /libpod/networks/{name} Remove a network
NetworksApi networkDisconnectLibpod POST /libpod/networks/{name}/disconnect Disconnect container from network
NetworksApi networkExistsLibpod GET /libpod/networks/{name}/exists Network exists
NetworksApi networkInspectLibpod GET /libpod/networks/{name}/json Inspect a network
NetworksApi networkListLibpod GET /libpod/networks/json List networks
NetworksApi networkPruneLibpod POST /libpod/networks/prune Delete unused networks
NetworksApi networkUpdateLibpod POST /libpod/networks/{name}/update Update existing podman network
NetworksCompatApi networkConnect POST /networks/{name}/connect Connect container to network
NetworksCompatApi networkCreate POST /networks/create Create network
NetworksCompatApi networkDelete DELETE /networks/{name} Remove a network
NetworksCompatApi networkDisconnect POST /networks/{name}/disconnect Disconnect container from network
NetworksCompatApi networkInspect GET /networks/{name} Inspect a network
NetworksCompatApi networkList GET /networks List networks
NetworksCompatApi networkPrune POST /networks/prune Delete unused networks
PodsApi generateKubeLibpod_0 GET /libpod/generate/kube Generate a Kubernetes YAML file.
PodsApi generateSystemdLibpod_0 GET /libpod/generate/{name}/systemd Generate Systemd Units
PodsApi kubeApplyLibpod_0 POST /libpod/kube/apply Apply a podman workload or Kubernetes YAML file.
PodsApi playKubeDownLibpod_0 DELETE /libpod/play/kube Remove resources created from kube play
PodsApi playKubeLibpod_0 POST /libpod/play/kube Play a Kubernetes YAML file.
PodsApi podCreateLibpod POST /libpod/pods/create Create a pod
PodsApi podDeleteLibpod DELETE /libpod/pods/{name} Remove pod
PodsApi podExistsLibpod GET /libpod/pods/{name}/exists Pod exists
PodsApi podInspectLibpod GET /libpod/pods/{name}/json Inspect pod
PodsApi podKillLibpod POST /libpod/pods/{name}/kill Kill a pod
PodsApi podListLibpod GET /libpod/pods/json List pods
PodsApi podPauseLibpod POST /libpod/pods/{name}/pause Pause a pod
PodsApi podPruneLibpod POST /libpod/pods/prune Prune unused pods
PodsApi podRestartLibpod POST /libpod/pods/{name}/restart Restart a pod
PodsApi podStartLibpod POST /libpod/pods/{name}/start Start a pod
PodsApi podStatsAllLibpod GET /libpod/pods/stats Statistics for one or more pods
PodsApi podStopLibpod POST /libpod/pods/{name}/stop Stop a pod
PodsApi podTopLibpod GET /libpod/pods/{name}/top List processes
PodsApi podUnpauseLibpod POST /libpod/pods/{name}/unpause Unpause a pod
SecretsApi secretCreateLibpod POST /libpod/secrets/create Create a secret
SecretsApi secretDeleteLibpod DELETE /libpod/secrets/{name} Remove secret
SecretsApi secretExistsLibpod GET /libpod/secrets/{name}/exists Secret exists
SecretsApi secretInspectLibpod GET /libpod/secrets/{name}/json Inspect secret
SecretsApi secretListLibpod GET /libpod/secrets/json List secrets
SecretsCompatApi secretCreate POST /secrets/create Create a secret
SecretsCompatApi secretDelete DELETE /secrets/{name} Remove secret
SecretsCompatApi secretInspect GET /secrets/{name} Inspect secret
SecretsCompatApi secretList GET /secrets List secrets
SystemApi systemCheckLibpod POST /libpod/system/check Performs consistency checks on storage, optionally removing items which fail checks
SystemApi systemDataUsageLibpod GET /libpod/system/df Show disk usage
SystemApi systemEventsLibpod GET /libpod/events Get events
SystemApi systemInfoLibpod GET /libpod/info Get info
SystemApi systemPing_0 GET /libpod/_ping Ping service
SystemApi systemPruneLibpod POST /libpod/system/prune Prune unused data
SystemApi systemVersionLibpod GET /libpod/version Component Version information
SystemCompatApi systemAuth POST /auth Check auth configuration
SystemCompatApi systemDataUsage GET /system/df Show disk usage
SystemCompatApi systemEvents GET /events Get events
SystemCompatApi systemInfo GET /info Get info
SystemCompatApi systemPing GET /libpod/_ping Ping service
SystemCompatApi systemVersion GET /version Component Version information
VolumesApi volumeCreateLibpod POST /libpod/volumes/create Create a volume
VolumesApi volumeDeleteLibpod DELETE /libpod/volumes/{name} Remove volume
VolumesApi volumeExistsLibpod GET /libpod/volumes/{name}/exists Volume exists
VolumesApi volumeInspectLibpod GET /libpod/volumes/{name}/json Inspect volume
VolumesApi volumeListLibpod GET /libpod/volumes/json List volumes
VolumesApi volumePruneLibpod POST /libpod/volumes/prune Prune volumes
VolumesCompatApi volumeCreate POST /volumes/create Create a volume
VolumesCompatApi volumeDelete DELETE /volumes/{name} Remove volume
VolumesCompatApi volumeInspect GET /volumes/{name} Inspect volume
VolumesCompatApi volumeList GET /volumes List volumes
VolumesCompatApi volumePrune POST /volumes/prune Prune volumes

Documentation for Models

Documentation for Authorization

Endpoints do not require authorization.

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

podman@lists.podman.io

About

Libpod API for Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages