Container create does not allow host port ranges #22980
Labels
kind/bug
Categorizes issue or PR as related to a bug.
locked - please file new issue/PR
Assist humans wanting to comment on an old issue or PR with locked comments.
network
Networking related issue or feature
Issue Description
When creating a container via dockers api, you can provide a range of ports for the host port. Docker will bind a port from this range that has not already been allocated. The range is specified with a dash e.g.
8080-8090
Calling the podman API with a range in this way results in an error.
The same can be seen calling the
create
subcommands. e.g.docker create -p 8080-8090:80 alpine sleep 100
Steps to reproduce the issue
Steps to reproduce the issue
docker create -p 8080-8090:80 alpine sleep 100
on a system with docker installed and see it is accepted. The container can then be starteddocker create -p 8080-8090:80 alpine sleep 100
on a system with podman installed and see the errorDescribe the results you received
Error response from daemon: make cli opts(): strconv.Atoi: parsing "8080-8090": invalid syntax
Which appears to originate from:
podman/pkg/api/handlers/compat/containers_create.go
Line 263 in bd00c6f
Describe the results you expected
No error returned and the container created with a port from the provided range allocated
podman info output
Podman in a container
No
Privileged Or Rootless
Privileged
Upstream Latest Release
Yes
Additional environment details
I've tested this in podman 5.0.2 on linux on an EC2 instance
I've also attempted it on podman desktop on mac against 5.1.1
Additional information
I have time to contribute a PR for this issue. Any advice about how best to solve this would be appreciated
The text was updated successfully, but these errors were encountered: