2

I have a azure function that i want to be able to deploy an image to container instances. But I get an error.

Exception: HttpResponseError: (InaccessibleImage) The image 'registryUrl/imageName:latest' in container group 'containerInstanceName' is not accessible. Please check the image and registry credential.
Code: InaccessibleImage

If i use one of microsoft example images it works. I've turned on identity and given the function contributer role on both the registry and the container instances for now.

Here is the code:

aciclient = ContainerInstanceManagementClient(credential, subscription_id)
resclient = ResourceManagementClient(credential, subscription_id)

# Configure the container
container_resource_requests = ResourceRequests(memory_in_gb=1.5, cpu=1.0)

container_resource_requirements = ResourceRequirements(
    requests=container_resource_requests)

container = Container(name=container_name,
                      image=container_image_name,
                      resources=container_resource_requirements,
                      command=start_command_line.split(),
                      environment_variables=[env_var_1, env_var_2])

# Configure the container group
group = ContainerGroup(location=resource_group_location,
                       containers=[container],
                       os_type=OperatingSystemTypes.linux,
                       restart_policy=ContainerGroupRestartPolicy.ON_FAILURE)

# Create the container group
result = aciclient.container_groups.begin_create_or_update(resource_group_name,
                                                      container_group_name,
                                                      group)

while result.done() is False:
    sys.stdout.write('.')
    time.sleep(0.1)

Something i've missed?

LittleMygler
  • 632
  • 10
  • 24

0 Answers0