1

The following are the files that are associated with the query and the commands I ran which led to these errors:

Dockerfile

# syntax=docker/dockerfile:1

FROM node:lts-alpine

WORKDIR /server

COPY package.json package-lock.json ./

FROM base as test
RUN npm ci --silent
COPY . .
EXPOSE 8080
CMD [ "npm", "run", "test" ]

FROM base as prod
RUN npm ci --production --silent
COPY . .
EXPOSE 8080
CMD [ "node", "start" ]

docker-compose.yml

version: "3.8"

services:
  customer_api:
    build:
      context: .
    ports:
      - 8080:8080
    volumes:
      - ./:/server
    command: npm start

Command run:

docker build -t customer --target prod .

Error stack trace [with buildkit]

[+] Building 7.6s (9/9) FINISHED                                                                                                                                
 => [internal] load build definition from Dockerfile                                                                                                       0.0s
 => => transferring dockerfile: 38B                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                          0.0s
 => => transferring context: 34B                                                                                                                           0.0s
 => resolve image config for docker.io/docker/dockerfile:1                                                                                                 5.3s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io                                                                                           0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc                            0.0s
 => [internal] load .dockerignore                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                       0.0s
 => ERROR [internal] load metadata for docker.io/library/base:latest                                                                                       2.0s
 => [auth] library/base:pull token for registry-1.docker.io                                                                                                0.0s
------
 > [internal] load metadata for docker.io/library/base:latest:
------
failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

Error stack trace [without buildkit]

Sending build context to Docker daemon  785.9kB
Step 1/13 : FROM node:lts-alpine
 ---> 5dcd1f6157bd
Step 2/13 : WORKDIR /server
 ---> Using cache
 ---> 838d1ca2775c
Step 3/13 : COPY package.json package-lock.json ./
 ---> 20c41a2cf967
Step 4/13 : FROM base as test
pull access denied for base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

Command run:

docker-compose -f docker-compose.dev.yml run customer_api npm run test

Error stack trace

WARNING: Found orphan containers (node_customer-api_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating node_customer_api_run ... done

> node@1.0.0 test
> mocha ./**/*.test.js --exit
 
Customer CRUD
    Create customer
      1) should create customer asynchronously

1) Customer CRUD
       Create customer
         should create customer asynchronously:
     Error: connect ECONNREFUSED 127.0.0.1:8080
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)

None of the following solutions worked in my case hence the question:

  1. docker-compose up error: "failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0" - Stack Overflow docker-compose up error: "failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0"
  2. go - ERROR: dockerfile parse error invalid field ' ' - Stack Overflow ERROR: dockerfile parse error invalid field ' '
  3. docker-compose up failed with the following error failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: - Stack Overflow docker-compose up failed with the following error failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0:
  4. node.js - Error: connect ECONNREFUSED 127.0.0.1:5432 - Stack Overflow Error: connect ECONNREFUSED 127.0.0.1:5432
  5. docker - An error, "failed to solve with frontend dockerfile.v0" - Stack Overflow An error, "failed to solve with frontend dockerfile.v0"
  6. dockerfile - denied: requested access to the resource is denied: docker - Stack Overflow denied: requested access to the resource is denied: docker
  7. node.js - Getting Error: connect ECONNREFUSED 127.0.0.1:6379 in docker-compose while connecting redis - Stack Overflow Getting Error: connect ECONNREFUSED 127.0.0.1:6379 in docker-compose while connecting redis
  8. node.js - Docker Compose getting error ECONNREFUSED 127.0.0.1:3306 with MySQL and NodeJS - Stack Overflow Docker Compose getting error ECONNREFUSED 127.0.0.1:3306 with MySQL and NodeJS
  • 1
    what docker repository do you think `base` should be? Looks to me like it was supposed to be a build stage, and `FROM node:lts-alpine` should be `FROM node:lts-alpine AS base` – erik258 Sep 15 '22 at 00:36
  • Thanks! that sorted the issue in the Dockerfile – Pragati Bhattad Sep 15 '22 at 06:01

0 Answers0