Open leiless opened 5 months ago
If I do the following changes to the docker-compose.yaml
, the port forwarding will work:
--- a/podman-compose-uid-gid-maps-port-fwd-not-working/docker-compose.yaml
+++ b/podman-compose-uid-gid-maps-port-fwd-not-working/docker-compose.yaml
@@ -7,15 +7,6 @@ services:
context: .
restart: "unless-stopped"
user: "2000:2000"
- x-podman:
- uidmaps:
- - "0:1:2000"
- - "2000:0:1"
- - "2001:2001:63536"
- gidmaps:
- - "0:1:2000"
- - "2000:0:1"
- - "2001:2001:63536"
ports:
- 127.0.0.1:30020:8080/tcp
#command: sleep infinity
$ podman-compose up
podman-compose version: 1.0.7
['podman', '--version', '']
using podman version: 3.4.4
** excluding: set()
['podman', 'inspect', '-t', 'image', '-f', '{{.Id}}', 'local/podman-compose-uid-gid-maps-port-fwd-not-working']
['podman', 'ps', '--filter', 'label=io.podman.compose.project=podman-compose-uid-gid-maps-port-fwd-not-working', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
podman pod create --name=pod_podman-compose-uid-gid-maps-port-fwd-not-working --infra=false --share=
b919e9cfe8d4c992b532ad48014468cbf961d684821b6d4a53c78338876073a6
exit code: 0
['podman', 'network', 'exists', 'podman-compose-uid-gid-maps-port-fwd-not-working_net']
podman create --name=podman-compose-uid-gid-maps-port-fwd-not-working_app_1 --pod=pod_podman-compose-uid-gid-maps-port-fwd-not-working --label io.podman.compose.config-hash=cb2cd1f4df19fc6ac17dd57e2fc757831b79e6100e25159fa949d04b23bf0f51 --label io.podman.compose.project=podman-compose-uid-gid-maps-port-fwd-not-working --label io.podman.compose.version=1.0.7 --label PODMAN_SYSTEMD_UNIT=podman-compose@podman-compose-uid-gid-maps-port-fwd-not-working.service --label com.docker.compose.project=podman-compose-uid-gid-maps-port-fwd-not-working --label com.docker.compose.project.working_dir=/tmp/podman-compose-uid-gid-maps-port-fwd-not-working --label com.docker.compose.project.config_files=docker-compose.yaml --label com.docker.compose.container-number=1 --label com.docker.compose.service=app --net podman-compose-uid-gid-maps-port-fwd-not-working_net --network-alias app -p 127.0.0.1:30020:8080/tcp -u 2000:2000 --restart unless-stopped local/podman-compose-uid-gid-maps-port-fwd-not-working darkhttpd /etc --no-listing
7645da5d504e94d166e1debdf3c986adc85f966d3f5351c9a8bc13ea3e2ba89f
exit code: 0
podman start -a podman-compose-uid-gid-maps-port-fwd-not-working_app_1
[app] | darkhttpd/1.16, copyright (c) 2003-2024 Emil Mikulic.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7645da5d504e localhost/local/podman-compose-uid-gid-maps-port-fwd-not-working:latest darkhttpd /etc --... 3 minutes ago Up 3 minutes ago 127.0.0.1:30020->8080/tcp podman-compose-uid-gid-maps-port-fwd-not-working_app_1
$ sudo netstat -tulpn | grep containers
tcp 0 0 127.0.0.1:30020 0.0.0.0:* LISTEN 653780/containers-r
$ curl -vL localhost:30020/alpine-release
* Trying 127.0.0.1:30020...
* Connected to localhost (127.0.0.1) port 30020 (#0)
> GET /alpine-release HTTP/1.1
> Host: localhost:30020
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Wed, 03 Jul 2024 09:22:30 GMT
< Server: darkhttpd/1.16
< Accept-Ranges: bytes
< Keep-Alive: timeout=30
< Content-Length: 7
< Content-Type: application/octet-stream
< Last-Modified: Tue, 18 Jun 2024 14:15:41 GMT
<
3.20.1
* Connection #0 to host localhost left intact
There might be an issue with how Podman 3.4.x handles port forwarding in conjunction with UID/GID mappings.
Closed, see: https://github.com/containers/podman/issues/23171
I think podman-compose should detect this scenario and issue a warning. It's easy enough to do so and will save users' time.
Describe the bug
I'm using podman-compose to deploy a simple app, but after the uid/gid mapping is set, the port forwarding is not working.
To Reproduce
The Dockerfile
docker-compose.yaml
Run
Expected behavior
The port forwarding
127.0.0.1:30020:8080/tcp
should be working.Actual behavior
The port forwarding
127.0.0.1:30020:8080/tcp
is not working.Environment:
I do NOT have any SELinux or AppArmor settings.