Edit

Troubleshoot "Web socket is closed or couldn't be opened" error in Azure Container Instances

Summary

This article explains how to mitigate the "Web socket is closed or couldn't be opened" error in Azure Container Instances (ACI). This error occurs when connecting to containers in a virtual network.

Symptoms

When you try to connect to your container from the Azure portal, you receive the following error message.

The following web socket error occurred: error: Web socket is closed or couldn't be opened. Please validate your network connection and retry the attempt.

Cause

Your firewall or corporate proxy blocks access to port 19390. This port is required to connect to ACI from the Azure portal when container groups are deployed in virtual networks.

Solution

To resolve this error, allow ingress to TCP port 19390 in your firewall. At a minimum, ensure that your firewall gives access to that port for all public client IP addresses that the Azure portal uses to connect.

In some scenarios where the corporate proxy blocks port 19390, allow this port for the corporate proxy, and then verify the traffic by using the Network tab in the browser developer tools.

For more information on reserved ports, see Does the ACI service reserve ports for service functionality?.