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:
Created an Azure Container Registry with the correct resource group and subscription ID.
Configured my Dockerfile and docker-compose.yml files accordingly.
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:
Verified that the Azure Container Registry exists and is in the correct resource group.
Checked and confirmed that I have the correct subscription ID and resource group specified in the docker-compose.yml file.
Ensured that I have the necessary permissions and access to the Azure subscription.
Logged in to Azure using the Azure CLI and confirmed that I'm using the correct subscription.
Tried specifying the subscription ID using the
--subscription
flag with thedocker-compose
command, but it didn't recognize the flag.