Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to restart docker compose instance / check image and resgistry credintial, inaccessible image #65

Closed
chip-davis opened this issue Jan 23, 2024 · 1 comment
Labels
need-to-triage Requires investigation

Comments

@chip-davis
Copy link

chip-davis commented Jan 23, 2024

Hello!

I have a project that I spun up with a docker compose file. The images are both in my azure container registry. The container instances were created fine. I used this GitHub action to build and push my images to the registry. This part works fine, and I can verify that the images were correctly updated. When I go to restart the container instances, I get the following error:

Failed to restart the container group 'my-container-group'. Error: Multiple error occurred: 'BadRequest':'InaccessibleImage':The image '{myregistry}/my-repo:my-image-tag' in container group 'my-container-group' is not accessible. Please check the image and registry credential.

This error repeats itself for the other image.

Here is my workflow file:

name: docker_build_push_acr

on:
  push:
    branches:
      - main

jobs:
  docker_build_push_acr:
    name: "Docker Build and Push to ACR"
    runs-on: ubuntu-latest
    environment: production

    # Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
    defaults:
      run:
        shell: bash

    steps:
      # Checkout the repository to the GitHub Actions runner
      - name: Checkout
        uses: actions/checkout@main

      - name: "Docker Login"
        uses: azure/docker-login@v1
        with:
          login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
          username: ${{ secrets.REGISTRY_USERNAME }}
          password: ${{ secrets.REGISTRY_PASSWORD }}
      - run: |
          docker build -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/my-repo:frontend-image ./front-end-directory
          docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/my-repo:frontend-image
          docker build -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/my-repo:backend-image ./backend-directory
          docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/my-repo:backend-image

Again, images are pushed to the registry successfully. It is just when I go to restart the container instance that I get this error. I have to delete the container instances and re-initiate them with my docker compose file to get it to start up again.

If it helps, here are my Dockerfiles and docker-compose:

Front end Dockerfile:

FROM node:20-alpine3.18 as build
WORKDIR /usr/app
COPY . /usr/app
RUN npm ci
RUN npm run build

FROM nginx:1.23.1-alpine
EXPOSE 80
COPY ./docker/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build /usr/app/dist /usr/share/nginx/html

Backend Dockerfile:

FROM oven/bun

WORKDIR /app

COPY package.json .
COPY bun.lockb .

RUN bun install --production

COPY src src
COPY tsconfig.json .
# COPY public public

ENV NODE_ENV production
CMD ["bun", "src/index.ts"]

EXPOSE 3009

Docker-compose:

version: "3.8"

services:
  frontend:
    image: my-container-registry/my-repo:frontend-image
    ports:
      - "80:80"
    depends_on:
      - backend
    container_name: frontend-container

  backend:
    image: my-container-registry/my-repo:backend-image
    ports:
      - "3009:3009"
    container_name: backend-container

Any help would be greatly appreciated!

@chip-davis chip-davis added the need-to-triage Requires investigation label Jan 23, 2024
@chip-davis
Copy link
Author

I switched to using Container Apps in Azure and set up CI/CD through that, so this is no longer an issue I am facing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-to-triage Requires investigation
Projects
None yet
Development

No branches or pull requests

1 participant