Merge pull request #765 from timocov/devel

Added handling `pid` option
This commit is contained in:
Povilas Kanapickas 2024-03-09 18:30:48 +02:00 committed by GitHub
commit f2f2f15a3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 0 deletions

View File

@ -981,6 +981,8 @@ async def container_to_args(compose, cnt, detached=True):
podman_args.append("--tty")
if cnt.get("privileged", None):
podman_args.append("--privileged")
if cnt.get("pid", None):
podman_args.extend(["--pid", cnt["pid"]])
pull_policy = cnt.get("pull_policy", None)
if pull_policy is not None and pull_policy != "build":
podman_args.extend(["--pull", pull_policy])

View File

@ -130,3 +130,25 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase):
with self.assertRaises(TypeError):
cnt["sysctls"] = wrong_type
await container_to_args(c, cnt)
async def test_pid(self):
c = create_compose_mock()
cnt = get_minimal_container()
cnt["pid"] = "host"
args = await container_to_args(c, cnt)
self.assertEqual(
args,
[
"--name=project_name_service_name1",
"-d",
"--net",
"",
"--network-alias",
"service_name",
"--pid",
"host",
"busybox",
],
)

View File

@ -0,0 +1,6 @@
version: "3"
services:
serv:
image: busybox
pid: host
command: sh -c "ps all"