Skip to content

Commit 91d316f

Browse files
committed
Added handling pid option
Fixes #554 Signed-off-by: Evgeniy Timokhov <timocov@gmail.com>
1 parent 121b5f6 commit 91d316f

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

podman_compose.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,8 @@ async def container_to_args(compose, cnt, detached=True):
981981
podman_args.append("--tty")
982982
if cnt.get("privileged", None):
983983
podman_args.append("--privileged")
984+
if cnt.get("pid", None):
985+
podman_args.extend(["--pid", cnt["pid"]])
984986
pull_policy = cnt.get("pull_policy", None)
985987
if pull_policy is not None and pull_policy != "build":
986988
podman_args.extend(["--pull", pull_policy])

pytests/test_container_to_args.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,25 @@ async def test_sysctl_wrong_type(self):
130130
with self.assertRaises(TypeError):
131131
cnt["sysctls"] = wrong_type
132132
await container_to_args(c, cnt)
133+
134+
async def test_pid(self):
135+
c = create_compose_mock()
136+
cnt = get_minimal_container()
137+
138+
cnt["pid"] = "host"
139+
140+
args = await container_to_args(c, cnt)
141+
self.assertEqual(
142+
args,
143+
[
144+
"--name=project_name_service_name1",
145+
"-d",
146+
"--net",
147+
"",
148+
"--network-alias",
149+
"service_name",
150+
"--pid",
151+
"host",
152+
"busybox",
153+
],
154+
)

tests/pid/docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: "3"
2+
services:
3+
serv:
4+
image: busybox
5+
pid: host
6+
command: sh -c "ps all"

0 commit comments

Comments
 (0)