Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Podman REST API from TestContainer

I develop a Java application using Maven 3 and Podman 1.8.0. I understand that Podman provide a Docker compatible REST API.

Java integration test use TestContainer framework. TestContainer is not able to connect to Podman REST API. I have the same problem with the python application use to test Podman. Is it a problem with user account? Does Podman 1.8 release support REST API yet?

Thx.

like image 693
Ruddy32 Avatar asked Oct 28 '25 05:10

Ruddy32


1 Answers

Podman 1.8 does not include Docker APIs, it was first introduced in v2.0. To enable the API Podman needs to start as a service, as explained in the previous link, or in the Podman documentation.

In my scripts I use something like this:

podman system service --time=0 & 
export DOCKER_HOST=unix:///var/run/user/$(id -u)/podman/podman.sock

DOCKER_HOST is set in the environment for the clients, to modify the default Docker daemon socket. The value may vary depending on how the service starts (root/rootless) as explained in Podman documentation.

I run in few issues using Podman v2 as a service and rootless mode, if you can I would suggest the latest 3+ at the time of writing.

like image 81
ddorsogna Avatar answered Oct 30 '25 21:10

ddorsogna