Skip to content

Commit

Permalink
Merge pull request #765 from timocov/devel
Browse files Browse the repository at this point in the history
Added handling `pid` option
  • Loading branch information
p12tic committed Mar 9, 2024
2 parents 121b5f6 + 91d316f commit f2f2f15
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
22 changes: 22 additions & 0 deletions pytests/test_container_to_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,25 @@ async def test_sysctl_wrong_type(self):
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",
],
)
6 changes: 6 additions & 0 deletions tests/pid/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3"
services:
serv:
image: busybox
pid: host
command: sh -c "ps all"

0 comments on commit f2f2f15

Please sign in to comment.