Skip to content

[Bug]: Binding host port < 1024 fails with permission error on explicit host IP (127.0.0.1:80), but succeeds on 0.0.0.0:80 #1985

Description

@TTAAAN

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

1. Steps to reproduce

  1. Attempt to bind host port 80 explicitly to 127.0.0.1:
container run --rm -p 127.0.0.1:80:80/tcp hello-world

Output: Error: failed to bootstrap container ... Permission denied while binding to host port 80. Binding to ports below 1024 requires root privileges.

  1. Attempt to bind host port 80 to 0.0.0.0 or without an explicit host IP:
container run --rm -p 0.0.0.0:80:80/tcp hello-world
# or
container run --rm -p 80:80/tcp hello-world

Output: Hello from Docker! (Succeeds)

  1. Attempt to run with sudo to bypass the 127.0.0.1:80 error:
sudo container run --rm -p 127.0.0.1:80:80/tcp hello-world

Output: Error: unauthorized request

2. Problem description

  • Binding host port < 1024 with 127.0.0.1 throws a permission validation error requiring root privileges.
  • Binding host port < 1024 with 0.0.0.0 or implicitly (-p 80:80) succeeds as a standard non-root user.
  • Executing with sudo fails with unauthorized request due to a daemon UID mismatch (client_euid=0 vs server_euid=501).

3. Expected Behavior

Port binding validation for privileged ports (< 1024) should be consistent regardless of whether a specific host IP (127.0.0.1) or wildcard IP (0.0.0.0) is specified. Binding to 127.0.0.1:80 as a standard user should succeed just as -p 80:80 and -p 0.0.0.0:80:80 do.

4. System Logs (container system logs)

2026-07-22 15:23:33.032990+0700 0x5ce44a   Error       0x0                  43573  0    container-apiserver: [com.apple.container:APIServer] route handler threw an error [route=containerBootstrap] [error=internalError: "failed to bootstrap container 116a41dd-3486-4772-a76c-4cd6512663c6" (cause: "invalidArgument: "Permission denied while binding to host port 80. Binding to ports below 1024 requires root privileges."")]
2026-07-22 15:23:33.034473+0700 0x5ce468   Info        0x0                  43573  0    container-apiserver: [com.apple.container:APIServer] ContainersService: enter [id=116a41dd-3486-4772-a76c-4cd6512663c6] [func=delete(id:force:)] [force=false]
2026-07-22 15:23:34.794230+0700 0x5cefc5   Error       0x0                  43573  0    container-apiserver: [com.apple.container:APIServer] unauthorized request - uid mismatch [client_euid=0] [server_euid=501]

5. Environment

- OS: macOS 26.5.2 (Build 25F84)
- Xcode: Not installed
- Container: container CLI version 1.1.0 (build: release)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions