I am trying to create container groups unsing azure javascript package @azure/arm-containerinstance
but there is very little documentation on an I am struggling to make it work. This is the code that I have implemented :
const name = "SOMECONTAINERNAME";
const image = "someregisterylink.com/somename/someimage:latest-sometag";
const port = 6901;
const environmentVariables = {
VAR1: "SOMEVAR",
VAR2: "SOMEVAR"
};
const containerResourceRequests = {
memoryInGB:1.5,
cpu:1
};
const containerResourceRequirements = {
requests:containerResourceRequests
}
const container = {
image: image,
resources: containerResourceRequirements,
command: ['/bin/bash','-c','echo $PATH'],
ports: [{port: port}],
environmentVariables: environmentVariables
};
const cgroup_os_type = "Linux";
const cgroup_ip_address = {
type: 'public',
ports: [{protocol: "TCP", port: port}]
}
const image_registry_credentials=null;
const cgroup = {
location: 'westus',
containers: [container],
os_type:cgroup_os_type,
ip_address: cgroup_ip_address
//image_registry_credentials: image_registry_credentials
}
var response = await azclient.containerGroups.beginCreateOrUpdate(
resourceGroupName=config.resourceGroup,
containerGroupName=name,
cgroup);
console.log(response);
The response is very verbose but this doesn't show any error, and nothing is created on the azure resourcegroup.
You can take reference of this Github source Code to create container groups using Azure ContainerInstanceManagement client library for JavaScript.
There is few Prerequisites that you requires .
Install the @azure/arm-containerinstance package.
Install the Azure ContainerInstanceManagement client library for JavaScript with npm:
Currently supported environments
For Detailed information Please refer this dcoument