Not Able to connect from inside Docker Container

Roy, Neeldeep @ Global D&T 0 Reputation points
2023-12-11T09:28:07.0366667+00:00

We are using Computer Vision API for one of our apps and we are not able to figure out what is the issue inside Docker container. It is working locally and we are able to get the response however when deployed in Cloud environment we are getting Host Not Found Exception. This is the url for our Azure Service.

"{Subscription_Name}.cognitiveservices.azure.com/computervision/imageanalysis"

Have verified there is no firewall issue as the same code when running inside a EC2 works fine and we only getting the exception when running inside the Docker container.

Has anyone come across this issue before?

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
329 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,490 questions
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 47,416 Reputation points
    2023-12-12T08:26:10.63+00:00

    @Roy, Neeldeep @ Global D&T

    Thanks for reaching out to us, could you please provide the document you are referring to us, so that we can reproduce your error and investigate further.

    Generally, there are several possible reasons you may want to consider -

    1. DNS resolution: Ensure that your Docker container can resolve DNS queries correctly. You can test this by executing a command like nslookup {Subscription_Name}.cognitiveservices.azure.com from within the container. If this fails, it may indicate a problem with DNS resolution.
    2. Network configuration: Verify the network configuration of your Docker container. Depending on how your Docker network is set up, it may not have access to the external network. You can try using the host network mode (--network=host when starting the container) as a test to see if this resolves the issue.
    3. Proxies: If your environment uses a proxy for internet access, you need to ensure that your Docker container is also configured to use this proxy. You can set the HTTP_PROXY and HTTPS_PROXY environment variables to the address of your proxy when starting the Docker container.
    4. Firewall / Security Groups: Even though you have mentioned it's not a firewall issue, it's worth double-checking the firewall rules or security groups associated with your Docker host and the network it's connected to. Ensure that they allow outbound connections to the Azure Cognitive Services API.
    5. Cognitive Services Configuration: Check the configuration of your Cognitive Services resource in the Azure portal. Make sure it's not restricted to certain IP addresses or networks.

    Please have a try and let me know how it works. If you still see this issue, please share more details, I hope this helps.

    Regards,

    Yutong

    -Please kindly accept the error if you feel helpful to support the community, thanks a lot.

    0 comments No comments