In my ML Workspace, when I create a VM with a custom application, the port does not appear to be opened properly

Josh Majors 0 Reputation points
2025-04-17T21:26:13.23+00:00

In Azure, we have an ML workspace. In that ML workspace, we're able to create a VM and connect to that VM over SSH just fine. However, I have a Docker Image I'd like to deploy to the VM via a Custom Application. When I try to assign a port to be bound to that docker container, it fails to bind the ports. The first screenshot has the configuration in the Azure portal, and the 2nd screenshot has the Docker container that's actually launched.

User's imageUser's image

The Docker container I highlighted from the CLI was created automatically by Azure, but the ports aren't bound correctly. I don't think the network rules have been setup to open the port to the Internet correctly either.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,339 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 22,031 Reputation points Volunteer Moderator
    2025-04-18T12:28:29.1933333+00:00

    Hello Josh Majors,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you're experiencing port mapping issues with your Azure ML.

    Since you are using Custom Application feature, which automates deployment. Kindly understand that Azure ML’s UI does not always bind ports correctly, requiring manual NSG/Docker configuration.

    1. Add NSG rules for custom ports specified in the UI. Manually add an inbound rule: Protocol: TCP Source Port: * Destination Port: 2222 Action: Allow Check this out: https://learn.microsoft.com/en-us/azure/virtual-network/manage-network-security-group#create-security-rules
    2. Run the bash command to verify the Docker Port Binding SSH into the VM:
         docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}"
      
      If the output does not show 0.0.0.0:2222->22/tcp, Azure ML failed to map the ports correctly. This is a known UI bug. Let me know and this is a workaround. However,
    3. Your Docker container’s application should be listening on port 22. If your app uses a different port such as 80, update the target port in the Azure portal to match: Target Port: 80 (container port), Published Port: 2222 (host port) and disable conflicting services and ports.
    4. Use Azure ML’s Managed Endpoints (Best Practice) will be a great gain.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is 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.