podman-rest-client
Provides an interface for querying the Podman REST API. Most of the interface is generated from the the official Podman swagger file. This crate adds a layer to make it possible to connect to the podman rest api over ssh to a unix socket and directly to a unix socket. Connections over ssh are commonly necessary on macOs where the container runtime runs in a virtual machine accessible over ssh.
API Compatibility
This crate currently only works with version 5 of the podman API. There are suffucient
differences between version 3, 4, and 5 that a lot of calls will not work in an older version.
podman --version
will reveal what version you are using.
Podman Socket
Note that podman does not run in a client/server model like docker does so there usually isn't a socket you can connect to by default. You might need to enable the socket for the library to connect to. For example on linux you might need to run something like this:
Usage
Linux
On linux you might initialize a client like this
use PodmanRestClient;
use Config;
// Initialize a client
let client = new.await.unwrap;
// Fetch a list of container images
let images = client.images_api.image_list_libpod.await.unwrap;
MacOs
On macOs you might initialize a client like this with an ssh url and identity file
let client = new.await.unwrap;
Config::guess
You can also use Config::guess()
which tries to find the default path to the podman
socket depending on the platform you are on.
// Setup the default configuration
let config = guess.await.unwrap;
// Initialize a client
let client = new.await.unwrap;
Changelog
v0.10.1
- Fix issue creating containers with mounted volumes #12
v0.10.0
- Parse error bodies whe encountering API errors #11
v0.9.1
- Fix for Config::guess on Linux #7
v0.9.0
- Config guessing logic on linux will return an error if a socket is not found
- Config guessing logic will also try to use the system socket if there is no user socket
- README.md documents some notes on initializing the podman socket
Breaking Changes
guess_configuration
is nowConfig::guess