mirror of
https://github.com/containers/podman-compose.git
synced 2025-02-10 07:20:07 +01:00
commit
f2f2f15a3b
@ -981,6 +981,8 @@ async def container_to_args(compose, cnt, detached=True):
|
|||||||
podman_args.append("--tty")
|
podman_args.append("--tty")
|
||||||
if cnt.get("privileged", None):
|
if cnt.get("privileged", None):
|
||||||
podman_args.append("--privileged")
|
podman_args.append("--privileged")
|
||||||
|
if cnt.get("pid", None):
|
||||||
|
podman_args.extend(["--pid", cnt["pid"]])
|
||||||
pull_policy = cnt.get("pull_policy", None)
|
pull_policy = cnt.get("pull_policy", None)
|
||||||
if pull_policy is not None and pull_policy != "build":
|
if pull_policy is not None and pull_policy != "build":
|
||||||
podman_args.extend(["--pull", pull_policy])
|
podman_args.extend(["--pull", pull_policy])
|
||||||
|
@ -130,3 +130,25 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase):
|
|||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
cnt["sysctls"] = wrong_type
|
cnt["sysctls"] = wrong_type
|
||||||
await container_to_args(c, cnt)
|
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
tests/pid/docker-compose.yml
Normal file
6
tests/pid/docker-compose.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
serv:
|
||||||
|
image: busybox
|
||||||
|
pid: host
|
||||||
|
command: sh -c "ps all"
|
Loading…
Reference in New Issue
Block a user