21장. Using the container-tools API
The new REST based Podman 2.0 API replaces the old remote API for Podman that used the varlink library. The new API works in both a rootful and a rootless environment.
The Podman v2.0 RESTful API consists of the Libpod API providing support for Podman, and Docker-compatible API. With this new REST API, you can call Podman from platforms such as cURL, Postman, Google’s Advanced REST client, and many others.
As the podman service supports socket activation, unless connections on the socket are active, podman service will not run. Hence, to enable socket activation functionality, you need to manually start the podman.socket service. When a connection becomes active on the socket, it starts the podman service and runs the requested API action. Once the action is completed, the podman process ends, and the podman service returns to an inactive state.
21.1. Enabling the Podman API using systemd in root mode 링크 복사링크가 클립보드에 복사되었습니다!
You can do the following:
-
Use
systemdto activate the Podman API socket. - Use a Podman client to perform basic commands.
Prerequisites
The
podman-remotepackage is installed.# dnf install podman-remote
Procedure
Start the service immediately:
# systemctl enable --now podman.socketTo enable the link to
var/lib/docker.sockby using thedocker-podmanpackage:# dnf install podman-docker
Verification
Display system information of Podman:
# podman-remote infoVerify the link:
# ls -al /var/run/docker.sock lrwxrwxrwx. 1 root root 23 Nov 4 10:19 /var/run/docker.sock -> /run/podman/podman.sock