azure-sdk-for-python: The image 'x' in container group 'y' is not accessible. Please check the image and registry credential.
- azure-mgmt-containerinstance
- 7.0.0
- Windows
- Python 3.8.7
Describe the bug Received message ‘Please check the image and registry credential.’ when attempting to create a container instance using an image in an Azure Container Registry.
To Reproduce Steps to reproduce the behavior:
# Create aci_client using default credentials loaded from Environment Variables
credential = DefaultAzureCredential(
exclude_cli_credential=True,
exclude_visual_studio_code_credential=True,
exclude_shared_token_cache_credential=True,
exclude_interactive_browser_credential=True,
)
aci_client = ContainerInstanceManagementClient(credential, subscription_id)
# Create Container and pass in Environment Variables
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.never)
# Create the container group
result = aci_client.container_groups.begin_create_or_update(resource_group.name,
container_group_name,
group)
# Error azure.core.exceptions.HttpResponseError: (InaccessibleImage) The image 'x' in container group 'y' is not accessible. Please check the image and registry credential.
Expected behavior The container instance should load the image from the Registry
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (2 by maintainers)
Hi Kerwin,
This code does not use a private Container registry. My use case fails when it tries to access an image in a private repo. Can you please show the code where you can pass credentials to the private repo?
On Fri, May 7, 2021 at 1:22 AM Kerwin(Kaihui) Sun @.***> wrote: