Unable to start a Node.js Container image on Azure Spot Container Instance

Mihir Rabade 20 Reputation points
2023-10-22T16:09:03.8733333+00:00

I created a Node.js container image with several environment variables (3 of them are secured) that work fine on my local machine but not on Azure Container Instance (Spot Container). The portal indicates the containers are in a 'Waiting' state and gives no startup logs. I've tried connecting via the portal, but the connection closes every time. My container is configured as:

  • CPU: 1 vCPU
  • Memory: 1 GB
  • Restart Policy: Never
  • OS Type: Linux
  • Location: West Europe
  • Container type: Spot Container

Since I don't have a quota for Standard ACI, I'm trying to figure out how to modify my source code to make the image start on Azure's Spot Container instance.

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

Accepted answer
  1. KarishmaTiwari-MSFT 19,872 Reputation points Microsoft Employee
    2023-10-31T21:15:10.3833333+00:00

    @Mihir Rabade

    I’m sorry to hear that you’re having trouble running your Node.js container image on Azure Container Instance (Spot Container). Based on your description, the container is not starting up properly and you’re unable to connect to it via the portal.

    This tutorial on Microsoft Learn explains how to deploy a Spot container group on Azure Container Instances using the Azure CLI. This tutorial provides step-by-step instructions on how to create a resource group, run a Spot container in Azure, and deploy an application to a Spot container on-demand. It also includes a sample code snippet that you can use as a reference.

    Additionally, this tutorial on Microsoft Learn explains how to deploy a Spot container to Azure Container Instances via portal.

    Let me know if you have tried these steps and are still facing the same issue.


    Let me know in the comments if you have further questions. Comment is the fastest way to reach the experts for any questions or help you need.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Mihir Rabade 20 Reputation points
    2023-11-07T15:53:32.3566667+00:00

    After a thorough debugging, I found out that there were 2 reasons my container was failing to start.

    1. Entry point was incorrect
    2. Supplying a multiline private key as (secure) environment variable throwed error ("Incorrect pem private key" or something similar)

    Solution:

    1. Fixed the build instructions so that entry point is now correct.
    2. Used base64 encoding to encode multiline env variable into single line & modified the codebase accordingly to accept & decode the value.
    0 comments No comments

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.