user15913196
user15913196

Reputation:

Docker nginx image issue

I’m newbie in using docker, but I want to dockerize my node.js + nginx + react.js app via docker compose and I get this error when trying create nginx image (login via docker hub doesn’t help):

ERROR [nodereactcrm_client] FROM docker.io/library/build:latest
failed to solve: rpc error: code = Unknown desc = failed to load cache key: pull access denied, repository
does not exist or may require authorization: server message: insufficient_scope: authorization failed

My react Dockerfile:

FROM node:alpine as builder


WORKDIR /app

ENV PATH /app/node_modules/.bin:$PATH

COPY package.json ./
COPY package-lock.json ./
RUN npm install

COPY . ./

FROM nginx

COPY --from=build /home/node/dist /usr/share/nginx/html

COPY ./default.conf /etc/nginx/conf.d

My docker-compose file:

version: '3'
services:
  db:
    container_name: db
    image: mysql
    ports:
      - '3306:3306'
    environment:
      MYSQL_ROOT_PASSWORD: root
  api:
    build:
      dockerfile: Dockerfile
      context: ./server
    volumes:
      - /app/node_modules
      - ./server:/app
    links:
      - db
    ports:
      - '5000:5000'
    depends_on:
      - db
  client:
    build:
      dockerfile: Dockerfile
      context: ./client
    volumes:
      - /app/node_modules
      - ./client:/app
    links:
      - api
    ports:
      - '80:80'

Upvotes: 0

Views: 2144

Answers (1)

user15913196
user15913196

Reputation:

As @anemyte answered - there was a typo. I needed just change COPY --from=build to COPY --from=builder

Upvotes: 1

Related Questions