When deploying web app using azure container registery gives error: failed to register layer: Error processing tar file(exit status 1): Container ID 718322462 cannot be mapped...authenticated required.
Hey, thanks for considering. Actually I was deploying my NestJS web app using docker to azure. First of all I built a docker image, my nest js app uses ffmpeg, python and some python related modules also, so in dockerfile i also added them. After building the image and pushing to my container registry I created a web app using that container registry. Yes I do checked that both run on same OS, that was linux. And yes when i connected i double checked the admin credentials. Even after doing this when the app is being deployed it generates the error:
2023-04-27T23:22:36.381Z ERROR - failed to register layer: Error processing tar file(exit status 1): Container ID 718322462 cannot be mapped to a host IDErr: 0, Message: failed to register layer: Error processing tar file(exit status 1): Container ID 718322462 cannot be mapped to a host ID 2023-04-27T23:22:36.386Z INFO - Pull Image failed, Time taken: 5 Minutes and 25 Seconds 2023-04-27T23:22:36.388Z ERROR - Pulling docker image subtitleo.azurecr.io/subtitleo:latest failed: 2023-04-27T23:22:36.727Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get \"https://subtitleo.azurecr.io/v2/subtitleo/manifests/latest\": unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information."} 2023-04-27T23:22:36.729Z WARN - Image pull failed. Defaulting to local copy if present. 2023-04-27T23:22:36.733Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository) 2023-04-27T23:22:36.736Z INFO - Stopping site subtitleo because it failed during startup.
So, I looked for solutions, tried to set the creds using CLI, no use, tried to re-create the web app, no use, tried to re-build and push the image, no use. Also tried to add the container as a private repository with the correct credentials. double checked. but still got the same error. and even when i save the private repository settings, after changing tabs in my web app it changes back to ACR setting default. dont know why.
Here is my docker file:
# Build stage
FROM node:18.15.0 AS build
# Install system dependencies
RUN apt-get update && \
apt-get install -y python3 python3-pip ffmpeg libass-dev \
libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev libpng-dev librsvg2-dev
# Install Whisper-ai
RUN pip3 install whisper-ai
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# Production stage
FROM node:18.15.0
# Install system dependencies
RUN apt-get update && \
apt-get install -y python3 python3-pip ffmpeg libass-dev \
libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev libpng-dev librsvg2-dev
# Install Whisper-ai
RUN pip3 install whisper-ai
WORKDIR /usr/src/app
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
COPY --from=build /usr/src/app/dist ./dist
COPY package*.json ./
RUN npm install --only=production
EXPOSE 80
CMD npm run start:prod
and here is my docker-compose:
version: '3'
services:
backend:
build: ./
container_name: subtitleo
environment:
- PORT=80
- S3_REGION=***
- S3_BUCKET=***
- S3_ACCESS_***
- S3_SECRET_ACCESS_KEY=***
- JWT_SECRET=***
- DB_HOST=***
- DB_PORT=***
- DB_USERNAME=***
- DB_PASSWORD=***
- DB_NAME=***
- DB_SYNCHRONIZE=***
- POSTMARK_API_TOKEN=***
- SUBTITLEO_SUPPORT_EMAIL=***
- SUBTITLEO_ADMIN_EMAIL=***
- SUBTITLEO_ADMIN_PASSWORD=***
ports:
- '80:80'
depends_on:
- db
networks:
- subtitleo
db:
image: postgres
restart: always
ports:
- '5432:5432'
environment:
POSTGRES_PASSWORD: ***
POSTGRES_DB: ***
networks:
- subtitleo
networks:
subtitleo:
driver: bridge