0

I'm trying to push a Docker image to an Azure Container Registry, but I'm encountering a "SubscriptionNotFound" error. I have followed the necessary steps to set up the Azure Container Registry and ensured that I have the correct subscription ID and resource group. However, when I run the docker-compose up command, I receive the following error message:

storage.AccountsClient#CheckNameAvailability: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="SubscriptionNotFound" Message="Subscription <subscription_id> was not found."

storage.AccountsClient#CheckNameAvailability: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="SubscriptionNotFound" Message="Subscription <subscription_id> was not found."

Steps I have taken:

  1. Created an Azure Container Registry with the correct resource group and subscription ID.

  2. Configured my Dockerfile and docker-compose.yml files accordingly.

  3. Installed the Azure CLI and logged in using the correct Azure subscription.

I have double-checked all the configurations, but I'm still unable to resolve the issue. I would appreciate any insights or suggestions on what could be causing this error and how to resolve it.

Code snippets:

Dockerfile:

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Library/Library.csproj", "Library/"]
COPY ["Library.Data/Library.Data.csproj", "Library.Data/"]
RUN dotnet restore "Library/Library.csproj"
COPY . .
WORKDIR "/src/Library"
RUN dotnet build "Library.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Library.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Library.dll"]

docker-compose.yaml:

version: '3.8'

services:
  sqlserver:
    container_name: sqlserver
    image: mcr.microsoft.com/mssql/server
    ports:
      - "1433:1433"
    deploy:
        resources:
           reservations:
                cpus: '2'
                memory: 2GB
    environment:
      - ACCEPT_EULA=Y
      - MSSQL_SA_PASSWORD=yourStrongPassword12#
    volumes:
      - sqldata:/var/opt/mssql/server
    environment:
      - subscription_id=<subsciption_id>

  web_app:
    container_name: web_app
    build:
        dockerfile: ./Dockerfile
    domainname: <my_name>-library
    ports:
      - "80:80"
    restart: on-failure
    depends_on:
      - sqlserver
    environment:
      - subscription_id=<subsciption_id>

volumes:
  sqldata:
      driver: azure_file
      driver_opts:
          share_name: sql-volume
          storage_account_name: kaloyan_123librarystacc

Any help or guidance would be greatly appreciated. Thank you!


Feel free to customize the content to fit your specific scenario and provide any additional information that might be relevant to your issue.

What I've Tried:

  1. Verified that the Azure Container Registry exists and is in the correct resource group.

  2. Checked and confirmed that I have the correct subscription ID and resource group specified in the docker-compose.yml file.

  3. Ensured that I have the necessary permissions and access to the Azure subscription.

  4. Logged in to Azure using the Azure CLI and confirmed that I'm using the correct subscription.

  5. Tried specifying the subscription ID using the --subscription flag with the docker-compose command, but it didn't recognize the flag.

1 Answers1

0

This might be a longshot, but according to this documentation...

SubscriptionNotFound:

A specified subscription for deployment can't be accessed.

It could be the subscription ID is wrong, the user deploying the template doesn't have adequate permissions to deploy to the subscription, or the subscription ID is in the wrong format. When using ARM template nested deployments to deploy across scopes, provide the subscription's GUID.

Maybe you need to use the subscription's GUID value in this case?

Jason Evans
  • 28,906
  • 14
  • 90
  • 154