Azure Container Instance haproxy port bind issue

Bernard Steyn 20 Reputation points
2023-08-10T09:13:35.25+00:00

Hey all,

I am having some issues running haproxy as a container instance when trying to bind to port 80/443 in the haproxy.cfg:

frontend fe-web
    bind *:80
    bind *:443 ssl crt certlocation

The container instance goes into a failed state, with error:

[ALERT]    (58) : Binding [/usr/local/etc/haproxy/haproxy.cfg:37] for frontend fe-web: cannot bind socket (Permission denied) for [0.0.0.0:80]
[ALERT]    (58) : Binding [/usr/local/etc/haproxy/haproxy.cfg:38] for frontend fe-web: cannot bind socket (Permission denied) for [0.0.0.0:443]

When I changed the bind ports to 8080 / 8443 , the container starts up fine without the permission denied error.

I have tried starting the container instance with --privileged , with --run-as--user 0 (or --run-as-user root) as well as --run-as-group 0 (or root). Still no luck.

Even changing the haproxy user in haproxy.cfg to root does not resolve the issue, example:

user haproxy
group haproxy

->

user root
group root

Does anyone have a solution for this? Is there a reason I am able to bind to ports 8080/8443, but not 80/443 in Azure?

Please let me know if any additional information is needed.

Thank you in advance!

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
757 questions
{count} votes

Accepted answer
  1. Deepanshukatara-6769 16,565 Reputation points Moderator
    2023-08-11T04:34:07.6866667+00:00

    Ok so to answer this ACI ( Azure container instance) service does reserve the following ports for service functionality: 22, 443, 1025-1027, 3389-3399, 9999, 19000, 19080, 19390, 19100, 20000-30000, 49152-65534. Avoid using these ports in your container group definition.

    document for reference: https://learn.microsoft.com/en-us/azure/container-instances/container-instances-faq

    I hope this answer your question, please accept if it does, Thanks!

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.