问题描述
我使用Maven 3和Podman 1.8.0开发Java应用程序.我了解Podman提供了与Docker兼容的REST API.
I develop a Java application using Maven 3 and Podman 1.8.0. I understand that Podman provide a Docker compatible REST API.
Java集成测试使用TestContainer框架.TestContainer无法连接到Podman REST API.我对用于测试Podman的python应用程序有相同的问题.用户帐户有问题吗?Podman 1.8版本是否支持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?
谢谢.
推荐答案
Podman 1.8不包含Docker API,它首先是在v2.0中引入.要启用API,Podman需要作为服务启动,如上一个链接所述,或在 Podman文档.
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,以修改默认的Docker守护程序套接字.根据 Podman文档.
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.
使用Podman v2作为服务和无根模式,我遇到了一些问题,如果可以的话,我建议撰写本文时,最新的3+ .
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.
这篇关于从TestContainer访问Podman REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!