containers / containers/podman-compose

podman-compose sets userns to container instead of pod

Open
#654 12 comments 9 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
6.2k
Forks
622
PR merge metrics
No merged PRs in 30d

Description

Hi,
using
- Ubuntu 22.04
- podman 3.4.4
- today's developer version of podman-create https://github.com/containers/podman-compose/archive/devel.tar.gz

I found a problem with userns. I was debugging why I cannot connect to port of containers when running with userns = keep-id.

consider the following docker-compose.yaml

services:

application:
image: alpine
command: nc -n -l -p 9000 -v
# userns_mode: keep-id
ports:
- "9000:9000"

run with podman-compose up --force-recreate it works as expected: Listens on port 9000. Just run a date | nc 127.0.0.1 9000
on the host machine and the container will print the date and terminate.

In contrast, when setting environment variable PODMAN_USERNS=keep-id , the host cannot connect to the container for not obvious reasons.

But when uncommenting the userns_mode line in the example above instead of using the environment, the podman create command issued by podman-compose prints an error message:

Error: --userns and --pod cannot be set together

As far as I can see, the mistake (at least with podman 3.x) is that podman-compose attaches the --userns keep-id parameter to the podman command to create the container, where – as far as I can see – it must be used to create the pod, if a pod is used. For reasons I have not yet understood podman does not seem to deal correctly with then environment variable in this case.

regards

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.