All URIs are relative to http://podman.io
Method | HTTP request | Description |
---|---|---|
containerAttachLibpod | POST /libpod/containers/{name}/attach | Attach to a container |
containerChangesLibpod | GET /libpod/containers/{name}/changes | Report on changes to container's filesystem; adds, deletes or modifications. |
containerCheckpointLibpod | POST /libpod/containers/{name}/checkpoint | Checkpoint a container |
containerCreateLibpod | POST /libpod/containers/create | Create a container |
containerDeleteLibpod | DELETE /libpod/containers/{name} | Delete container |
containerExistsLibpod | GET /libpod/containers/{name}/exists | Check if container exists |
containerExportLibpod | GET /libpod/containers/{name}/export | Export a container |
containerHealthcheckLibpod | GET /libpod/containers/{name}/healthcheck | Run a container's healthcheck |
containerInitLibpod | POST /libpod/containers/{name}/init | Initialize a container |
containerInspectLibpod | GET /libpod/containers/{name}/json | Inspect container |
containerKillLibpod | POST /libpod/containers/{name}/kill | Kill container |
containerListLibpod | GET /libpod/containers/json | List containers |
containerLogsLibpod | GET /libpod/containers/{name}/logs | Get container logs |
containerMountLibpod | POST /libpod/containers/{name}/mount | Mount a container |
containerPauseLibpod | POST /libpod/containers/{name}/pause | Pause a container |
containerPruneLibpod | POST /libpod/containers/prune | Delete stopped containers |
containerRenameLibpod | POST /libpod/containers/{name}/rename | Rename an existing container |
containerResizeLibpod | POST /libpod/containers/{name}/resize | Resize a container's TTY |
containerRestartLibpod | POST /libpod/containers/{name}/restart | Restart a container |
containerRestoreLibpod | POST /libpod/containers/{name}/restore | Restore a container |
containerShowMountedLibpod | GET /libpod/containers/showmounted | Show mounted containers |
containerStartLibpod | POST /libpod/containers/{name}/start | Start a container |
containerStatsLibpod | GET /libpod/containers/{name}/stats | Get stats for a container |
containerStopLibpod | POST /libpod/containers/{name}/stop | Stop a container |
containerTopLibpod | GET /libpod/containers/{name}/top | List processes |
containerUnmountLibpod | POST /libpod/containers/{name}/unmount | Unmount a container |
containerUnpauseLibpod | POST /libpod/containers/{name}/unpause | Unpause Container |
containerUpdateLibpod | POST /libpod/containers/{name}/update | Updates the configuration of an existing container, allowing changes to resource limits and healthchecks |
containerWaitLibpod | POST /libpod/containers/{name}/wait | Wait on a container |
containersStatsAllLibpod | GET /libpod/containers/stats | Get stats for one or more containers |
generateKubeLibpod | GET /libpod/generate/kube | Generate a Kubernetes YAML file. |
generateSystemdLibpod | GET /libpod/generate/{name}/systemd | Generate Systemd Units |
imageCommitLibpod | POST /libpod/commit | Commit |
kubeApplyLibpod | POST /libpod/kube/apply | Apply a podman workload or Kubernetes YAML file. |
playKubeDownLibpod | DELETE /libpod/play/kube | Remove resources created from kube play |
playKubeLibpod | POST /libpod/play/kube | Play a Kubernetes YAML file. |
putContainerArchiveLibpod | PUT /libpod/containers/{name}/archive | Copy files into a container |
containerAttachLibpod(name).detachKeys(detachKeys).logs(logs).stream(stream).stdout(stdout).stderr(stderr).stdin(stdin).execute();
Attach to a container
Attach to a container to read its output or send it input. You can attach to the same container multiple times and you can reattach to containers that have been detached. ### Hijacking This endpoint hijacks the HTTP connection to transport `stdin`, `stdout`, and `stderr` on the same socket. This is the response from the service for an attach request: ``` HTTP/1.1 200 OK Content-Type: application/vnd.docker.raw-stream [STREAM] ``` After the headers and two new lines, the TCP connection can now be used for raw, bidirectional communication between the client and server. To inform potential proxies about connection hijacking, the client can also optionally send connection upgrade headers. For example, the client sends this request to upgrade the connection: ``` POST /v4.6.0/libpod/containers/16253994b7c4/attach?stream=1&stdout=1 HTTP/1.1 Upgrade: tcp Connection: Upgrade ``` The service will respond with a `101 UPGRADED` response, and will similarly follow with the raw stream: ``` HTTP/1.1 101 UPGRADED Content-Type: application/vnd.docker.raw-stream Connection: Upgrade Upgrade: tcp [STREAM] ``` ### Stream format When the TTY setting is disabled for the container, the HTTP Content-Type header is set to application/vnd.docker.multiplexed-stream (starting with v4.7.0, previously application/vnd.docker.raw-stream was always used) and the stream over the hijacked connected is multiplexed to separate out `stdout` and `stderr`. The stream consists of a series of frames, each containing a header and a payload. The header contains the information about the output stream type and the size of the payload. It is encoded on the first eight bytes like this: ```go header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4} ``` `STREAM_TYPE` can be: - 0: `stdin` (is written on `stdout`) - 1: `stdout` - 2: `stderr` `SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of the `uint32` size encoded as big endian. Following the header is the payload, which contains the specified number of bytes as written in the size. The simplest way to implement this protocol is the following: 1. Read 8 bytes. 2. Choose `stdout` or `stderr` depending on the first byte. 3. Extract the frame size from the last four bytes. 4. Read the extracted size and output it on the correct output. 5. Goto 1. ### Stream format when using a TTY When the TTY setting is enabled for the container, the stream is not multiplexed. The data exchanged over the hijacked connection is simply the raw data from the process PTY and client's `stdin`.
// 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.models.*;
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();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
detachKeys | String | keys to use for detaching from the container | [optional] |
logs | 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 | [optional] |
stream | 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 | [optional] [default to true] |
stdout | Boolean | Attach to container STDOUT | [optional] |
stderr | Boolean | Attach to container STDERR | [optional] |
stdin | Boolean | Attach to container STDIN | [optional] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
101 | No error, connection has been hijacked for transporting streams. | - |
400 | Bad parameter in request | - |
404 | No such container | - |
500 | Internal server error | - |
containerChangesLibpod(name).parent(parent).diffType(diffType).execute();
Report on changes to container's filesystem; adds, deletes or modifications.
Returns which files in a container's filesystem have been added, deleted, or modified. The Kind of modification can be one of: 0: Modified 1: Added 2: Deleted
// 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.models.*;
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 parent = "parent_example"; // String | specify a second layer which is used to compare against it instead of the parent layer
String diffType = "all"; // String | select what you want to match, default is all
try {
apiInstance.containerChangesLibpod(name)
.parent(parent)
.diffType(diffType)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerChangesLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or id of the container | |
parent | String | specify a second layer which is used to compare against it instead of the parent layer | [optional] |
diffType | String | select what you want to match, default is all | [optional] [enum: all, container, image] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json, application/octet-stream, text/plain
Status code | Description | Response headers |
---|---|---|
200 | Array of Changes | - |
404 | No such container | - |
500 | Internal server error | - |
containerCheckpointLibpod(name).keep(keep).leaveRunning(leaveRunning).tcpEstablished(tcpEstablished).export(export).ignoreRootFS(ignoreRootFS).ignoreVolumes(ignoreVolumes).preCheckpoint(preCheckpoint).withPrevious(withPrevious).fileLocks(fileLocks).printStats(printStats).execute();
Checkpoint a container
// 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.models.*;
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
Boolean keep = true; // Boolean | keep all temporary checkpoint files
Boolean leaveRunning = true; // Boolean | leave the container running after writing checkpoint to disk
Boolean tcpEstablished = true; // Boolean | checkpoint a container with established TCP connections
Boolean export = true; // Boolean | export the checkpoint image to a tar.gz
Boolean ignoreRootFS = true; // Boolean | do not include root file-system changes when exporting. can only be used with export
Boolean ignoreVolumes = true; // Boolean | do not include associated volumes. can only be used with export
Boolean preCheckpoint = true; // Boolean | dump the container's memory information only, leaving the container running. only works on runc 1.0-rc or higher
Boolean withPrevious = true; // Boolean | check out the container with previous criu image files in pre-dump. only works on runc 1.0-rc or higher
Boolean fileLocks = true; // Boolean | checkpoint a container with filelocks
Boolean printStats = true; // Boolean | add checkpoint statistics to the returned CheckpointReport
try {
apiInstance.containerCheckpointLibpod(name)
.keep(keep)
.leaveRunning(leaveRunning)
.tcpEstablished(tcpEstablished)
.export(export)
.ignoreRootFS(ignoreRootFS)
.ignoreVolumes(ignoreVolumes)
.preCheckpoint(preCheckpoint)
.withPrevious(withPrevious)
.fileLocks(fileLocks)
.printStats(printStats)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerCheckpointLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
keep | Boolean | keep all temporary checkpoint files | [optional] |
leaveRunning | Boolean | leave the container running after writing checkpoint to disk | [optional] |
tcpEstablished | Boolean | checkpoint a container with established TCP connections | [optional] |
export | Boolean | export the checkpoint image to a tar.gz | [optional] |
ignoreRootFS | Boolean | do not include root file-system changes when exporting. can only be used with export | [optional] |
ignoreVolumes | Boolean | do not include associated volumes. can only be used with export | [optional] |
preCheckpoint | Boolean | dump the container's memory information only, leaving the container running. only works on runc 1.0-rc or higher | [optional] |
withPrevious | Boolean | check out the container with previous criu image files in pre-dump. only works on runc 1.0-rc or higher | [optional] |
fileLocks | Boolean | checkpoint a container with filelocks | [optional] |
printStats | Boolean | add checkpoint statistics to the returned CheckpointReport | [optional] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | tarball is returned in body if exported | - |
404 | No such container | - |
500 | Internal server error | - |
ContainerCreateResponse containerCreateLibpod(create).execute();
Create a container
// 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.models.*;
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);
SpecGenerator create = new SpecGenerator(); // SpecGenerator | attributes for creating a container
try {
ContainerCreateResponse result = apiInstance.containerCreateLibpod(create)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerCreateLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
create | SpecGenerator | attributes for creating a container |
No authorization required
- Content-Type: application/json, application/x-tar
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
201 | Create container | - |
400 | Bad parameter in request | - |
404 | No such container | - |
409 | Conflict error in operation | - |
500 | Internal server error | - |
List<LibpodContainersRmReport> containerDeleteLibpod(name).depend(depend).force(force).ignore(ignore).timeout(timeout).v(v).execute();
Delete container
Delete container
// 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.models.*;
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
Boolean depend = true; // Boolean | additionally remove containers that depend on the container to be removed
Boolean force = true; // Boolean | force stop container if running
Boolean ignore = true; // Boolean | ignore errors when the container to be removed does not existxo
Integer timeout = 10; // Integer | number of seconds to wait before killing container when force removing
Boolean v = true; // Boolean | delete volumes
try {
List<LibpodContainersRmReport> result = apiInstance.containerDeleteLibpod(name)
.depend(depend)
.force(force)
.ignore(ignore)
.timeout(timeout)
.v(v)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerDeleteLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
depend | Boolean | additionally remove containers that depend on the container to be removed | [optional] |
force | Boolean | force stop container if running | [optional] |
ignore | Boolean | ignore errors when the container to be removed does not existxo | [optional] |
timeout | Integer | number of seconds to wait before killing container when force removing | [optional] [default to 10] |
v | Boolean | delete volumes | [optional] |
List<LibpodContainersRmReport>
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Remove Containers | - |
204 | no error | - |
400 | Bad parameter in request | - |
404 | No such container | - |
409 | Conflict error in operation | - |
500 | Internal server error | - |
containerExistsLibpod(name).execute();
Check if container exists
Quick way to determine if a container exists by name or ID
// 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.models.*;
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
try {
apiInstance.containerExistsLibpod(name)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerExistsLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | container exists | - |
404 | No such container | - |
500 | Internal server error | - |
containerExportLibpod(name).execute();
Export a container
Export the contents of a container as a tarball.
// 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.models.*;
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
try {
apiInstance.containerExportLibpod(name)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerExportLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | tarball is returned in body | - |
404 | No such container | - |
500 | Internal server error | - |
HealthCheckResults containerHealthcheckLibpod(name).execute();
Run a container's healthcheck
Execute the defined healthcheck and return information about the results
// 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.models.*;
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
try {
HealthCheckResults result = apiInstance.containerHealthcheckLibpod(name)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerHealthcheckLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Healthcheck Results | - |
404 | No such container | - |
409 | container has no healthcheck or is not running | - |
500 | Internal server error | - |
containerInitLibpod(name).execute();
Initialize a container
Performs all tasks necessary for initializing the container but does not start the container.
// 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.models.*;
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
try {
apiInstance.containerInitLibpod(name)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerInitLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | no error | - |
304 | container already initialized | - |
404 | No such container | - |
500 | Internal server error | - |
InspectContainerData containerInspectLibpod(name).size(size).execute();
Inspect container
Return low-level information about a container.
// 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.models.*;
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
Boolean size = true; // Boolean | display filesystem usage
try {
InspectContainerData result = apiInstance.containerInspectLibpod(name)
.size(size)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerInspectLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
size | Boolean | display filesystem usage | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Inspect container | - |
404 | No such container | - |
500 | Internal server error | - |
containerKillLibpod(name).signal(signal).execute();
Kill container
send a signal to a container, defaults to killing the container
// 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.models.*;
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 signal = "SIGKILL"; // String | signal to be sent to container, either by integer or SIG_ name
try {
apiInstance.containerKillLibpod(name)
.signal(signal)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerKillLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
signal | String | signal to be sent to container, either by integer or SIG_ name | [optional] [default to SIGKILL] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | no error | - |
404 | No such container | - |
409 | Conflict error in operation | - |
500 | Internal server error | - |
List<ListContainer> containerListLibpod().all(all).limit(limit).namespace(namespace).pod(pod).size(size).sync(sync).filters(filters).execute();
List containers
Returns a list of containers
// 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.models.*;
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);
Boolean all = false; // Boolean | Return all containers. By default, only running containers are shown
Integer limit = 56; // Integer | Return this number of most recently created containers, including non-running ones.
Boolean namespace = false; // Boolean | Include namespace information
Boolean pod = false; // Boolean | Ignored. Previously included details on pod name and ID that are currently included by default.
Boolean size = false; // Boolean | Return the size of container as fields SizeRw and SizeRootFs.
Boolean sync = false; // Boolean | Sync container state with OCI runtime
String filters = "filters_example"; // String | A JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters: - `ancestor`=(`<image-name>[:<tag>]`, `<image id>`, or `<image@digest>`) - `before`=(`<container id>` or `<container name>`) - `expose`=(`<port>[/<proto>]` or `<startport-endport>/[<proto>]`) - `exited=<int>` containers with exit code of `<int>` - `health`=(`starting`, `healthy`, `unhealthy` or `none`) - `id=<ID>` a container's ID - `is-task`=(`true` or `false`) - `label`=(`key` or `\"key=value\"`) of a container label - `name=<name>` a container's name - `network`=(`<network id>` or `<network name>`) - `pod`=(`<pod id>` or `<pod name>`) - `publish`=(`<port>[/<proto>]` or `<startport-endport>/[<proto>]`) - `since`=(`<container id>` or `<container name>`) - `status`=(`created`, `restarting`, `running`, `removing`, `paused`, `exited` or `dead`) - `volume`=(`<volume name>` or `<mount point destination>`)
try {
List<ListContainer> result = apiInstance.containerListLibpod()
.all(all)
.limit(limit)
.namespace(namespace)
.pod(pod)
.size(size)
.sync(sync)
.filters(filters)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerListLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
all | Boolean | Return all containers. By default, only running containers are shown | [optional] [default to false] |
limit | Integer | Return this number of most recently created containers, including non-running ones. | [optional] |
namespace | Boolean | Include namespace information | [optional] [default to false] |
pod | Boolean | Ignored. Previously included details on pod name and ID that are currently included by default. | [optional] [default to false] |
size | Boolean | Return the size of container as fields SizeRw and SizeRootFs. | [optional] [default to false] |
sync | Boolean | Sync container state with OCI runtime | [optional] [default to false] |
filters | String | A JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters: - `ancestor`=(`<image-name>[:<tag>]`, `<image id>`, or `<image@digest>`) - `before`=(`<container id>` or `<container name>`) - `expose`=(`<port>[/<proto>]` or `<startport-endport>/[<proto>]`) - `exited=<int>` containers with exit code of `<int>` - `health`=(`starting`, `healthy`, `unhealthy` or `none`) - `id=<ID>` a container's ID - `is-task`=(`true` or `false`) - `label`=(`key` or `"key=value"`) of a container label - `name=<name>` a container's name - `network`=(`<network id>` or `<network name>`) - `pod`=(`<pod id>` or `<pod name>`) - `publish`=(`<port>[/<proto>]` or `<startport-endport>/[<proto>]`) - `since`=(`<container id>` or `<container name>`) - `status`=(`created`, `restarting`, `running`, `removing`, `paused`, `exited` or `dead`) - `volume`=(`<volume name>` or `<mount point destination>`) | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List Containers | - |
400 | Bad parameter in request | - |
500 | Internal server error | - |
containerLogsLibpod(name).follow(follow).stdout(stdout).stderr(stderr).since(since).until(until).timestamps(timestamps).tail(tail).execute();
Get container logs
Get stdout and stderr logs from a container. The stream format is the same as described in the attach endpoint.
// 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.models.*;
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
Boolean follow = true; // Boolean | Keep connection after returning logs.
Boolean stdout = true; // Boolean | Return logs from stdout
Boolean stderr = true; // Boolean | Return logs from stderr
String since = "since_example"; // String | Only return logs since this time, as a UNIX timestamp
String until = "until_example"; // String | Only return logs before this time, as a UNIX timestamp
Boolean timestamps = false; // Boolean | Add timestamps to every log line
String tail = "all"; // String | Only return this number of log lines from the end of the logs
try {
apiInstance.containerLogsLibpod(name)
.follow(follow)
.stdout(stdout)
.stderr(stderr)
.since(since)
.until(until)
.timestamps(timestamps)
.tail(tail)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerLogsLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
follow | Boolean | Keep connection after returning logs. | [optional] |
stdout | Boolean | Return logs from stdout | [optional] |
stderr | Boolean | Return logs from stderr | [optional] |
since | String | Only return logs since this time, as a UNIX timestamp | [optional] |
until | String | Only return logs before this time, as a UNIX timestamp | [optional] |
timestamps | Boolean | Add timestamps to every log line | [optional] [default to false] |
tail | String | Only return this number of log lines from the end of the logs | [optional] [default to all] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | logs returned as a stream in response body. | - |
404 | No such container | - |
500 | Internal server error | - |
String containerMountLibpod(name).execute();
Mount a container
Mount a container to the filesystem
// 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.models.*;
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
try {
String result = apiInstance.containerMountLibpod(name)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerMountLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container |
String
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | mounted container | - |
404 | No such container | - |
500 | Internal server error | - |
containerPauseLibpod(name).execute();
Pause a container
Use the cgroups freezer to suspend all processes in a container.
// 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.models.*;
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
try {
apiInstance.containerPauseLibpod(name)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerPauseLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | no error | - |
404 | No such container | - |
500 | Internal server error | - |
List<ContainersPruneReportLibpod> containerPruneLibpod().filters(filters).execute();
Delete stopped containers
Remove containers not in use
// 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.models.*;
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 filters = "filters_example"; // String | Filters to process on the prune list, encoded as JSON (a `map[string][]string`). Available filters: - `until=<timestamp>` Prune containers created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. - `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune containers with (or without, in case `label!=...` is used) the specified labels.
try {
List<ContainersPruneReportLibpod> result = apiInstance.containerPruneLibpod()
.filters(filters)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerPruneLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
filters | String | Filters to process on the prune list, encoded as JSON (a `map[string][]string`). Available filters: - `until=<timestamp>` Prune containers created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. - `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune containers with (or without, in case `label!=...` is used) the specified labels. | [optional] |
List<ContainersPruneReportLibpod>
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Prune Containers | - |
500 | Internal server error | - |
containerRenameLibpod(name, name2).execute();
Rename an existing container
Change the name of an existing container.
// 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.models.*;
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 | Full or partial ID or full name of the container to rename
String name2 = "name_example"; // String | New name for the container
try {
apiInstance.containerRenameLibpod(name, name2)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerRenameLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | Full or partial ID or full name of the container to rename | |
name2 | String | New name for the container |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | no error | - |
404 | No such container | - |
409 | Conflict error in operation | - |
500 | Internal server error | - |
Object containerResizeLibpod(name).h(h).w(w).execute();
Resize a container's TTY
Resize the terminal attached to a container (for use with Attach).
// 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.models.*;
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
Integer h = 56; // Integer | Height to set for the terminal, in characters
Integer w = 56; // Integer | Width to set for the terminal, in characters
try {
Object result = apiInstance.containerResizeLibpod(name)
.h(h)
.w(w)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerResizeLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
h | Integer | Height to set for the terminal, in characters | [optional] |
w | Integer | Width to set for the terminal, in characters | [optional] |
Object
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
404 | No such container | - |
409 | Conflict error in operation | - |
500 | Internal server error | - |
containerRestartLibpod(name).t(t).execute();
Restart a container
// 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.models.*;
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
Integer t = 10; // Integer | number of seconds to wait before killing container
try {
apiInstance.containerRestartLibpod(name)
.t(t)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerRestartLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
t | Integer | number of seconds to wait before killing container | [optional] [default to 10] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | no error | - |
404 | No such container | - |
500 | Internal server error | - |
containerRestoreLibpod(name).name2(name2).keep(keep).tcpEstablished(tcpEstablished)._import(_import).ignoreRootFS(ignoreRootFS).ignoreVolumes(ignoreVolumes).ignoreStaticIP(ignoreStaticIP).ignoreStaticMAC(ignoreStaticMAC).fileLocks(fileLocks).printStats(printStats).pod(pod).execute();
Restore a container
Restore a container from a checkpoint.
// 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.models.*;
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 name2 = "name_example"; // String | the name of the container when restored from a tar. can only be used with import
Boolean keep = true; // Boolean | keep all temporary checkpoint files
Boolean tcpEstablished = true; // Boolean | checkpoint a container with established TCP connections
Boolean _import = true; // Boolean | import the restore from a checkpoint tar.gz
Boolean ignoreRootFS = true; // Boolean | do not include root file-system changes when exporting. can only be used with import
Boolean ignoreVolumes = true; // Boolean | do not restore associated volumes. can only be used with import
Boolean ignoreStaticIP = true; // Boolean | ignore IP address if set statically
Boolean ignoreStaticMAC = true; // Boolean | ignore MAC address if set statically
Boolean fileLocks = true; // Boolean | restore a container with file locks
Boolean printStats = true; // Boolean | add restore statistics to the returned RestoreReport
String pod = "pod_example"; // String | pod to restore into
try {
apiInstance.containerRestoreLibpod(name)
.name2(name2)
.keep(keep)
.tcpEstablished(tcpEstablished)
._import(_import)
.ignoreRootFS(ignoreRootFS)
.ignoreVolumes(ignoreVolumes)
.ignoreStaticIP(ignoreStaticIP)
.ignoreStaticMAC(ignoreStaticMAC)
.fileLocks(fileLocks)
.printStats(printStats)
.pod(pod)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerRestoreLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or id of the container | |
name2 | String | the name of the container when restored from a tar. can only be used with import | [optional] |
keep | Boolean | keep all temporary checkpoint files | [optional] |
tcpEstablished | Boolean | checkpoint a container with established TCP connections | [optional] |
_import | Boolean | import the restore from a checkpoint tar.gz | [optional] |
ignoreRootFS | Boolean | do not include root file-system changes when exporting. can only be used with import | [optional] |
ignoreVolumes | Boolean | do not restore associated volumes. can only be used with import | [optional] |
ignoreStaticIP | Boolean | ignore IP address if set statically | [optional] |
ignoreStaticMAC | Boolean | ignore MAC address if set statically | [optional] |
fileLocks | Boolean | restore a container with file locks | [optional] |
printStats | Boolean | add restore statistics to the returned RestoreReport | [optional] |
pod | String | pod to restore into | [optional] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | tarball is returned in body if exported | - |
404 | No such container | - |
500 | Internal server error | - |
Map<String, String> containerShowMountedLibpod().execute();
Show mounted containers
Lists all mounted containers mount points
// 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.models.*;
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);
try {
Map<String, String> result = apiInstance.containerShowMountedLibpod()
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerShowMountedLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
This endpoint does not need any parameter.
Map<String, String>
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | mounted containers | - |
500 | Internal server error | - |
containerStartLibpod(name).detachKeys(detachKeys).execute();
Start a container
// 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.models.*;
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 = "ctrl-p,ctrl-q"; // String | Override the key sequence for detaching a container. Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, , or _.
try {
apiInstance.containerStartLibpod(name)
.detachKeys(detachKeys)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerStartLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
detachKeys | String | Override the key sequence for detaching a container. Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, , or _. | [optional] [default to ctrl-p,ctrl-q] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | no error | - |
304 | Container already started | - |
404 | No such container | - |
500 | Internal server error | - |
containerStatsLibpod(name).stream(stream).execute();
Get stats for a container
DEPRECATED. This endpoint will be removed with the next major release. Please use /libpod/containers/stats instead.
// 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.models.*;
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
Boolean stream = true; // Boolean | Stream the output
try {
apiInstance.containerStatsLibpod(name)
.stream(stream)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerStatsLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
stream | Boolean | Stream the output | [optional] [default to true] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | no error | - |
404 | No such container | - |
409 | Conflict error in operation | - |
500 | Internal server error | - |
containerStopLibpod(name).timeout(timeout).ignore(ignore).execute();
Stop a container
// 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.models.*;
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
Integer timeout = 10; // Integer | number of seconds to wait before killing container
Boolean ignore = false; // Boolean | do not return error if container is already stopped
try {
apiInstance.containerStopLibpod(name)
.timeout(timeout)
.ignore(ignore)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerStopLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
timeout | Integer | number of seconds to wait before killing container | [optional] [default to 10] |
ignore | Boolean | do not return error if container is already stopped | [optional] [default to false] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | no error | - |
304 | Container already stopped | - |
404 | No such container | - |
500 | Internal server error | - |
ContainerTopOKBody containerTopLibpod(name).stream(stream).delay(delay).psArgs(psArgs).execute();
List processes
List processes running inside a container
// 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.models.*;
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 | Name of container to query for processes (As of version 1.xx)
Boolean stream = true; // Boolean | when true, repeatedly stream the latest output (As of version 4.0)
Integer delay = 5; // Integer | if streaming, delay in seconds between updates. Must be >1. (As of version 4.0)
List<String> psArgs = Arrays.asList(); // List<String> | arguments to pass to ps such as aux.
try {
ContainerTopOKBody result = apiInstance.containerTopLibpod(name)
.stream(stream)
.delay(delay)
.psArgs(psArgs)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerTopLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | Name of container to query for processes (As of version 1.xx) | |
stream | Boolean | when true, repeatedly stream the latest output (As of version 4.0) | [optional] |
delay | Integer | if streaming, delay in seconds between updates. Must be >1. (As of version 4.0) | [optional] [default to 5] |
psArgs | List<String> | arguments to pass to ps such as aux. | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List processes in container | - |
404 | No such container | - |
500 | Internal server error | - |
containerUnmountLibpod(name).execute();
Unmount a container
Unmount a container from the filesystem
// 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.models.*;
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
try {
apiInstance.containerUnmountLibpod(name)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerUnmountLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | ok | - |
404 | No such container | - |
500 | Internal server error | - |
containerUnpauseLibpod(name).execute();
Unpause Container
// 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.models.*;
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
try {
apiInstance.containerUnpauseLibpod(name)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerUnpauseLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | no error | - |
404 | No such container | - |
500 | Internal server error | - |
ContainerUpdateLibpod201Response containerUpdateLibpod(name).restartPolicy(restartPolicy).restartRetries(restartRetries).config(config).execute();
Updates the configuration of an existing container, allowing changes to resource limits and healthchecks
Updates the configuration of an existing container, allowing changes to resource limits and healthchecks.
// 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.models.*;
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 | Full or partial ID or full name of the container to update
String restartPolicy = "restartPolicy_example"; // String | New restart policy for the container.
Integer restartRetries = 56; // Integer | New amount of retries for the container's restart policy. Only allowed if restartPolicy is set to on-failure
UpdateEntities config = new UpdateEntities(); // UpdateEntities | attributes for updating the container
try {
ContainerUpdateLibpod201Response result = apiInstance.containerUpdateLibpod(name)
.restartPolicy(restartPolicy)
.restartRetries(restartRetries)
.config(config)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerUpdateLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | Full or partial ID or full name of the container to update | |
restartPolicy | String | New restart policy for the container. | [optional] |
restartRetries | Integer | New amount of retries for the container's restart policy. Only allowed if restartPolicy is set to on-failure | [optional] |
config | UpdateEntities | attributes for updating the container | [optional] |
ContainerUpdateLibpod201Response
No authorization required
- Content-Type: application/json, application/x-tar
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
201 | Update container | - |
400 | Bad parameter in request | - |
404 | No such container | - |
500 | Internal server error | - |
Integer containerWaitLibpod(name).condition(condition).interval(interval).execute();
Wait on a container
Wait on a container to meet a given condition
// 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.models.*;
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
List<String> condition = Arrays.asList(); // List<String> | Conditions to wait for. If no condition provided the 'exited' condition is assumed.
String interval = "250ms"; // String | Time Interval to wait before polling for completion.
try {
Integer result = apiInstance.containerWaitLibpod(name)
.condition(condition)
.interval(interval)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containerWaitLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | the name or ID of the container | |
condition | List<String> | Conditions to wait for. If no condition provided the 'exited' condition is assumed. | [optional] [enum: configured, created, exited, healthy, initialized, paused, removing, running, stopped, stopping, unhealthy] |
interval | String | Time Interval to wait before polling for completion. | [optional] [default to 250ms] |
Integer
No authorization required
- Content-Type: Not defined
- Accept: application/json, text/plain
Status code | Description | Response headers |
---|---|---|
200 | Status code | - |
404 | No such container | - |
500 | Internal server error | - |
ContainerStats containersStatsAllLibpod().containers(containers).stream(stream).interval(interval).execute();
Get stats for one or more containers
Return a live stream of resource usage statistics of one or more container. If no container is specified, the statistics of all containers are returned.
// 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.models.*;
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);
List<String> containers = Arrays.asList(); // List<String> | names or IDs of containers
Boolean stream = true; // Boolean | Stream the output
Integer interval = 5; // Integer | Time in seconds between stats reports
try {
ContainerStats result = apiInstance.containersStatsAllLibpod()
.containers(containers)
.stream(stream)
.interval(interval)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#containersStatsAllLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
containers | List<String> | names or IDs of containers | [optional] |
stream | Boolean | Stream the output | [optional] [default to true] |
interval | Integer | Time in seconds between stats reports | [optional] [default to 5] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Get stats for one or more containers | - |
404 | No such container | - |
500 | Internal server error | - |
File generateKubeLibpod(names).service(service).type(type).replicas(replicas).noTrunc(noTrunc).podmanOnly(podmanOnly).execute();
Generate a Kubernetes YAML file.
Generate Kubernetes YAML based on a pod or container.
// 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.models.*;
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);
List<String> names = Arrays.asList(); // List<String> | Name or ID of the container or pod.
Boolean service = false; // Boolean | Generate YAML for a Kubernetes service object.
String type = "pod"; // String | Generate YAML for the given Kubernetes kind.
Integer replicas = 0; // Integer | Set the replica number for Deployment kind.
Boolean noTrunc = false; // Boolean | don't truncate annotations to the Kubernetes maximum length of 63 characters
Boolean podmanOnly = false; // Boolean | add podman-only reserved annotations in generated YAML file (cannot be used by Kubernetes)
try {
File result = apiInstance.generateKubeLibpod(names)
.service(service)
.type(type)
.replicas(replicas)
.noTrunc(noTrunc)
.podmanOnly(podmanOnly)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#generateKubeLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
names | List<String> | Name or ID of the container or pod. | |
service | Boolean | Generate YAML for a Kubernetes service object. | [optional] [default to false] |
type | String | Generate YAML for the given Kubernetes kind. | [optional] [default to pod] |
replicas | Integer | Set the replica number for Deployment kind. | [optional] [default to 0] |
noTrunc | Boolean | don't truncate annotations to the Kubernetes maximum length of 63 characters | [optional] [default to false] |
podmanOnly | Boolean | add podman-only reserved annotations in generated YAML file (cannot be used by Kubernetes) | [optional] [default to false] |
No authorization required
- Content-Type: Not defined
- Accept: text/vnd.yaml, application/json
Status code | Description | Response headers |
---|---|---|
200 | Kubernetes YAML file describing pod | - |
500 | Internal server error | - |
Map<String, String> generateSystemdLibpod(name).useName(useName)._new(_new).noHeader(noHeader).startTimeout(startTimeout).stopTimeout(stopTimeout).restartPolicy(restartPolicy).containerPrefix(containerPrefix).podPrefix(podPrefix).separator(separator).restartSec(restartSec).wants(wants).after(after).requires(requires).additionalEnvVariables(additionalEnvVariables).execute();
Generate Systemd Units
Generate Systemd Units based on a pod or container.
// 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.models.*;
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 | Name or ID of the container or pod.
Boolean useName = false; // Boolean | Use container/pod names instead of IDs.
Boolean _new = false; // Boolean | Create a new container instead of starting an existing one.
Boolean noHeader = false; // Boolean | Do not generate the header including the Podman version and the timestamp.
Integer startTimeout = 0; // Integer | Start timeout in seconds.
Integer stopTimeout = 10; // Integer | Stop timeout in seconds.
String restartPolicy = "no"; // String | Systemd restart-policy.
String containerPrefix = "container"; // String | Systemd unit name prefix for containers.
String podPrefix = "pod"; // String | Systemd unit name prefix for pods.
String separator = "-"; // String | Systemd unit name separator between name/id and prefix.
Integer restartSec = 0; // Integer | Configures the time to sleep before restarting a service.
List<String> wants = Arrays.asList(); // List<String> | Systemd Wants list for the container or pods.
List<String> after = Arrays.asList(); // List<String> | Systemd After list for the container or pods.
List<String> requires = Arrays.asList(); // List<String> | Systemd Requires list for the container or pods.
List<String> additionalEnvVariables = Arrays.asList(); // List<String> | Set environment variables to the systemd unit files.
try {
Map<String, String> result = apiInstance.generateSystemdLibpod(name)
.useName(useName)
._new(_new)
.noHeader(noHeader)
.startTimeout(startTimeout)
.stopTimeout(stopTimeout)
.restartPolicy(restartPolicy)
.containerPrefix(containerPrefix)
.podPrefix(podPrefix)
.separator(separator)
.restartSec(restartSec)
.wants(wants)
.after(after)
.requires(requires)
.additionalEnvVariables(additionalEnvVariables)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#generateSystemdLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | Name or ID of the container or pod. | |
useName | Boolean | Use container/pod names instead of IDs. | [optional] [default to false] |
_new | Boolean | Create a new container instead of starting an existing one. | [optional] [default to false] |
noHeader | Boolean | Do not generate the header including the Podman version and the timestamp. | [optional] [default to false] |
startTimeout | Integer | Start timeout in seconds. | [optional] [default to 0] |
stopTimeout | Integer | Stop timeout in seconds. | [optional] [default to 10] |
restartPolicy | String | Systemd restart-policy. | [optional] [default to on-failure] [enum: no, on-success, on-failure, on-abnormal, on-watchdog, on-abort, always] |
containerPrefix | String | Systemd unit name prefix for containers. | [optional] [default to container] |
podPrefix | String | Systemd unit name prefix for pods. | [optional] [default to pod] |
separator | String | Systemd unit name separator between name/id and prefix. | [optional] [default to -] |
restartSec | Integer | Configures the time to sleep before restarting a service. | [optional] [default to 0] |
wants | List<String> | Systemd Wants list for the container or pods. | [optional] |
after | List<String> | Systemd After list for the container or pods. | [optional] |
requires | List<String> | Systemd Requires list for the container or pods. | [optional] |
additionalEnvVariables | List<String> | Set environment variables to the systemd unit files. | [optional] |
Map<String, String>
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | no error | - |
500 | Internal server error | - |
imageCommitLibpod(container).author(author).changes(changes).comment(comment).format(format).pause(pause).squash(squash).repo(repo).stream(stream).tag(tag).execute();
Commit
Create a new image from a container
// 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.models.*;
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 container = "container_example"; // String | the name or ID of a container
String author = "author_example"; // String | author of the image
List<String> changes = Arrays.asList(); // List<String> | instructions to apply while committing in Dockerfile format (i.e. \"CMD=/bin/foo\")
String comment = "comment_example"; // String | commit message
String format = "format_example"; // String | format of the image manifest and metadata (default \"oci\")
Boolean pause = true; // Boolean | pause the container before committing it
Boolean squash = true; // Boolean | squash the container before committing it
String repo = "repo_example"; // String | the repository name for the created image
Boolean stream = true; // Boolean | output from commit process
String tag = "tag_example"; // String | tag name for the created image
try {
apiInstance.imageCommitLibpod(container)
.author(author)
.changes(changes)
.comment(comment)
.format(format)
.pause(pause)
.squash(squash)
.repo(repo)
.stream(stream)
.tag(tag)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#imageCommitLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
container | String | the name or ID of a container | |
author | String | author of the image | [optional] |
changes | List<String> | instructions to apply while committing in Dockerfile format (i.e. "CMD=/bin/foo") | [optional] |
comment | String | commit message | [optional] |
format | String | format of the image manifest and metadata (default "oci") | [optional] |
pause | Boolean | pause the container before committing it | [optional] |
squash | Boolean | squash the container before committing it | [optional] |
repo | String | the repository name for the created image | [optional] |
stream | Boolean | output from commit process | [optional] |
tag | String | tag name for the created image | [optional] |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
201 | no error | - |
404 | No such image | - |
500 | Internal server error | - |
File kubeApplyLibpod().caCertFile(caCertFile).kubeConfig(kubeConfig).namespace(namespace).service(service)._file(_file).request(request).execute();
Apply a podman workload or Kubernetes YAML file.
Deploy a podman container, pod, volume, or Kubernetes yaml to a Kubernetes cluster.
// 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.models.*;
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 caCertFile = "caCertFile_example"; // String | Path to the CA cert file for the Kubernetes cluster.
String kubeConfig = "kubeConfig_example"; // String | Path to the kubeconfig file for the Kubernetes cluster.
String namespace = "namespace_example"; // String | The namespace to deploy the workload to on the Kubernetes cluster.
Boolean service = true; // Boolean | Create a service object for the container being deployed.
String _file = "_file_example"; // String | Path to the Kubernetes yaml file to deploy.
String request = "request_example"; // String | Kubernetes YAML file.
try {
File result = apiInstance.kubeApplyLibpod()
.caCertFile(caCertFile)
.kubeConfig(kubeConfig)
.namespace(namespace)
.service(service)
._file(_file)
.request(request)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#kubeApplyLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
caCertFile | String | Path to the CA cert file for the Kubernetes cluster. | [optional] |
kubeConfig | String | Path to the kubeconfig file for the Kubernetes cluster. | [optional] |
namespace | String | The namespace to deploy the workload to on the Kubernetes cluster. | [optional] |
service | Boolean | Create a service object for the container being deployed. | [optional] |
_file | String | Path to the Kubernetes yaml file to deploy. | [optional] |
request | String | Kubernetes YAML file. | [optional] |
No authorization required
- Content-Type: application/json, application/x-tar
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Kubernetes YAML file successfully deployed to cluster | - |
500 | Internal server error | - |
PlayKubeReport playKubeDownLibpod().contentType(contentType).force(force).request(request).execute();
Remove resources created from kube play
Tears down pods, secrets, and volumes defined in a YAML file
// 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.models.*;
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 contentType = "text/plain"; // String |
Boolean force = false; // Boolean | Remove volumes.
String request = "request_example"; // String | Kubernetes YAML file.
try {
PlayKubeReport result = apiInstance.playKubeDownLibpod()
.contentType(contentType)
.force(force)
.request(request)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#playKubeDownLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
contentType | String | [optional] [default to text/plain] [enum: text/plain, application/x-tar] | |
force | Boolean | Remove volumes. | [optional] [default to false] |
request | String | Kubernetes YAML file. | [optional] |
No authorization required
- Content-Type: text/plain, application/x-tar
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | PlayKube response | - |
500 | Internal server error | - |
PlayKubeReport playKubeLibpod().contentType(contentType).annotations(annotations).logDriver(logDriver).logOptions(logOptions).network(network).noHosts(noHosts).noTrunc(noTrunc).publishPorts(publishPorts).publishAllPorts(publishAllPorts).replace(replace).serviceContainer(serviceContainer).start(start).staticIPs(staticIPs).staticMACs(staticMACs).tlsVerify(tlsVerify).userns(userns).wait(wait).build(build).request(request).execute();
Play a Kubernetes YAML file.
Create and run pods based on a Kubernetes YAML file. ### Content-Type Then endpoint support two Content-Type - `text/plain` for yaml format - `application/x-tar` for sending context(s) required for building images #### Tar format The tar format must contain a `play.yaml` file at the root that will be used. If the file format requires context to build an image, it uses the image name and check for corresponding folder. For example, the client sends a tar file with the following structure: ``` └── content.tar ├── play.yaml └── foobar/ └── Containerfile ``` The `play.yaml` is the following, the `foobar` image means we are looking for a context with this name. ``` apiVersion: v1 kind: Pod metadata: name: demo-build-remote spec: containers: - name: container image: foobar ```
// 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.models.*;
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 contentType = "text/plain"; // String |
String annotations = "annotations_example"; // String | JSON encoded value of annotations (a map[string]string).
String logDriver = "logDriver_example"; // String | Logging driver for the containers in the pod.
List<String> logOptions = Arrays.asList(); // List<String> | logging driver options
List<String> network = Arrays.asList(); // List<String> | USe the network mode or specify an array of networks.
Boolean noHosts = false; // Boolean | do not setup /etc/hosts file in container
Boolean noTrunc = false; // Boolean | use annotations that are not truncated to the Kubernetes maximum length of 63 characters
List<String> publishPorts = Arrays.asList(); // List<String> | publish a container's port, or a range of ports, to the host
Boolean publishAllPorts = true; // Boolean | Whether to publish all ports defined in the K8S YAML file (containerPort, hostPort), if false only hostPort will be published
Boolean replace = false; // Boolean | replace existing pods and containers
Boolean serviceContainer = false; // Boolean | Starts a service container before all pods.
Boolean start = true; // Boolean | Start the pod after creating it.
List<String> staticIPs = Arrays.asList(); // List<String> | Static IPs used for the pods.
List<String> staticMACs = Arrays.asList(); // List<String> | Static MACs used for the pods.
Boolean tlsVerify = true; // Boolean | Require HTTPS and verify signatures when contacting registries.
String userns = "userns_example"; // String | Set the user namespace mode for the pods.
Boolean wait = false; // Boolean | Clean up all objects created when a SIGTERM is received or pods exit.
Boolean build = true; // Boolean | Build the images with corresponding context.
String request = "request_example"; // String | Kubernetes YAML file.
try {
PlayKubeReport result = apiInstance.playKubeLibpod()
.contentType(contentType)
.annotations(annotations)
.logDriver(logDriver)
.logOptions(logOptions)
.network(network)
.noHosts(noHosts)
.noTrunc(noTrunc)
.publishPorts(publishPorts)
.publishAllPorts(publishAllPorts)
.replace(replace)
.serviceContainer(serviceContainer)
.start(start)
.staticIPs(staticIPs)
.staticMACs(staticMACs)
.tlsVerify(tlsVerify)
.userns(userns)
.wait(wait)
.build(build)
.request(request)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#playKubeLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
contentType | String | [optional] [default to text/plain] [enum: text/plain, application/x-tar] | |
annotations | String | JSON encoded value of annotations (a map[string]string). | [optional] |
logDriver | String | Logging driver for the containers in the pod. | [optional] |
logOptions | List<String> | logging driver options | [optional] |
network | List<String> | USe the network mode or specify an array of networks. | [optional] |
noHosts | Boolean | do not setup /etc/hosts file in container | [optional] [default to false] |
noTrunc | Boolean | use annotations that are not truncated to the Kubernetes maximum length of 63 characters | [optional] [default to false] |
publishPorts | List<String> | publish a container's port, or a range of ports, to the host | [optional] |
publishAllPorts | Boolean | Whether to publish all ports defined in the K8S YAML file (containerPort, hostPort), if false only hostPort will be published | [optional] |
replace | Boolean | replace existing pods and containers | [optional] [default to false] |
serviceContainer | Boolean | Starts a service container before all pods. | [optional] [default to false] |
start | Boolean | Start the pod after creating it. | [optional] [default to true] |
staticIPs | List<String> | Static IPs used for the pods. | [optional] |
staticMACs | List<String> | Static MACs used for the pods. | [optional] |
tlsVerify | Boolean | Require HTTPS and verify signatures when contacting registries. | [optional] [default to true] |
userns | String | Set the user namespace mode for the pods. | [optional] |
wait | Boolean | Clean up all objects created when a SIGTERM is received or pods exit. | [optional] [default to false] |
build | Boolean | Build the images with corresponding context. | [optional] |
request | String | Kubernetes YAML file. | [optional] |
No authorization required
- Content-Type: text/plain, application/x-tar
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | PlayKube response | - |
500 | Internal server error | - |
putContainerArchiveLibpod(name, path).pause(pause).request(request).execute();
Copy files into a container
Copy a tar archive of files into a container
// 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.models.*;
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 | container name or id
String path = "path_example"; // String | Path to a directory in the container to extract
Boolean pause = true; // Boolean | pause the container while copying (defaults to true)
String request = "request_example"; // String | tarfile of files to copy into the container
try {
apiInstance.putContainerArchiveLibpod(name, path)
.pause(pause)
.request(request)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling ContainersApi#putContainerArchiveLibpod");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | container name or id | |
path | String | Path to a directory in the container to extract | |
pause | Boolean | pause the container while copying (defaults to true) | [optional] [default to true] |
request | String | tarfile of files to copy into the container | [optional] |
null (empty response body)
No authorization required
- Content-Type: application/json, application/x-tar
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | no error | - |
400 | Bad parameter in request | - |
403 | the container rootfs is read-only | - |
404 | No such container | - |
500 | Internal server error | - |