Problem with Docker local drive volumes on Windows10 WLS2

Asked

Viewed 13 times

-2

I have a problem with Docker volumes, in my first project everything went right now in another I have this error, when I will run again the 1 project works when vo. For another of that mistake. I’m used wsl2 on Windows 10

I’ve been in this folder. I deleted it, but the error still happens.

\\wsl$\docker-desktop-data\version-pack-data\community\docker
executor failed running [/bin/sh -c npm install]: exit code: 1
ERROR: Service 'app' failed to build : Build failed
  • dockerfile
FROM node:alpine

WORKDIR /usr/app

COPY package.json ./

RUN npm install

COPY . .

EXPOSE 3333

CMD ["npm", "run", "dev"]

  • Docker-Compose
version: '3.7'

services:
  postgres_bd:
    image: postgres
    container_name: user
    ports:
      - 5432:5432
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=docker
      - POSTGRES_DB=cadastro-de-usuarios
    volumes:
      - pgdata:/data/postgres

  mongo_db:
    image: mongo
    container_name: notification
    ports:
      - 27017:27017
    environment:
      - MONGO_INITDB_ROOT_USERNAME=mongo
      - MONGO_INITDB_ROOT_PASSWORD=docker
      - MONGO_INITDB_DATABASE=cadastro-e-login
    volumes:
      - ./mgdata:/var/lib/data/mongodb

  app:
    build: .
    container_name: node
    ports:
      - 3333:3333
    volumes:
      - .:/usr/app
    depends_on:
      - postgres_bd
      - mongo_db

volumes:
  pgdata:
    driver: local
  • log
Building app
[+] Building 84.1s (8/9)
 => [internal] load build definition from Dockerfile                                                               0.1s 
 => => transferring dockerfile: 176B                                                                               0.1s 
 => [internal] load .dockerignore                                                                                  0.1s 
 => => transferring context: 69B                                                                                   0.0s 
 => [internal] load metadata for docker.io/library/node:alpine                                                    25.4s 
 => [1/5] FROM docker.io/library/node:alpine@sha256:1ee1478ef46a53fc0584729999a0570cf2fb174fbfe0370edbf09680b237  16.4s 
 => => resolve docker.io/library/node:alpine@sha256:1ee1478ef46a53fc0584729999a0570cf2fb174fbfe0370edbf09680b2378  0.1s 
 => => sha256:540db60ca9383eac9e418f78490994d0af424aab7bf6d0e47ac8ed4e2e9bcbba 2.81MB / 2.81MB                     0.9s 
 => => sha256:2ccfc847721bd5a61efe0179179ab9944724f4742ec73aed54e9cc9e440b15e0 35.46MB / 35.46MB                   5.8s 
 => => sha256:1ee1478ef46a53fc0584729999a0570cf2fb174fbfe0370edbf09680b2378b56 1.43kB / 1.43kB                     0.0s 
 => => sha256:65ccf08f9e0e15861e1d241ff90aeb293d86e080b68b5053b888ee38db887289 1.16kB / 1.16kB                     0.0s 
 => => sha256:d2adab47ce8f2b64403ec60f6d543d3b5cb8e114a28887f5a66fa4386938664a 6.53kB / 6.53kB                     0.0s 
 => => sha256:0fb557f738857421ec65b07c40ff8443578c7ffd7baffcff0182a4244890eb01 2.35MB / 2.35MB                     1.4s 
 => => extracting sha256:540db60ca9383eac9e418f78490994d0af424aab7bf6d0e47ac8ed4e2e9bcbba                          0.6s 
 => => sha256:2816020507ac6142dd6ae22622faa1440017048a9ad17864ecf6c253b0449c28 281B / 281B                         1.6s 
 => => extracting sha256:2ccfc847721bd5a61efe0179179ab9944724f4742ec73aed54e9cc9e440b15e0                          3.4s 
 => => extracting sha256:0fb557f738857421ec65b07c40ff8443578c7ffd7baffcff0182a4244890eb01                          0.3s 
 => => extracting sha256:2816020507ac6142dd6ae22622faa1440017048a9ad17864ecf6c253b0449c28                          0.0s 
 => [internal] load build context                                                                                  0.5s 
 => => transferring context: 472.51kB                                                                              0.4s 
 => [2/5] WORKDIR /usr/app                                                                                         2.4s 
 => [3/5] COPY package.json ./                                                                                     1.4s 
 => ERROR [4/5] RUN npm install                                                                                   37.8s 
------
 > [4/5] RUN npm install:
#8 36.16 npm notice
#8 36.16 npm notice New patch version of npm available! 7.21.0 -> 7.21.1
#8 36.16 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.21.1>
#8 36.16 npm notice Run `npm install -g [email protected]` to update!
#8 36.16 npm notice
#8 36.16 npm ERR! code ERESOLVE
#8 36.17 npm ERR! ERESOLVE unable to resolve dependency tree
#8 36.17 npm ERR!
#8 36.17 npm ERR! While resolving: [email protected]
#8 36.17 npm ERR! Found: [email protected]
#8 36.17 npm ERR! node_modules/eslint
#8 36.17 npm ERR!   dev eslint@"^5.16.0" from the root project
#8 36.17 npm ERR!
#8 36.17 npm ERR! Could not resolve dependency:
#8 36.17 npm ERR! peer eslint@">=7.0.0" from [email protected]
#8 36.17 npm ERR! node_modules/eslint-config-prettier
#8 36.17 npm ERR!   dev eslint-config-prettier@"^8.3.0" from the root project
#8 36.17 npm ERR!
#8 36.17 npm ERR! Fix the upstream dependency conflict, or retry
#8 36.17 npm ERR! this command with --force, or --legacy-peer-deps
#8 36.17 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
#8 36.17 npm ERR!
#8 36.18 npm ERR! See /root/.npm/eresolve-report.txt for a full report.
#8 36.30
#8 36.30 npm ERR! A complete log of this run can be found in:
#8 36.30 npm ERR!     /root/.npm/_logs/2021-08-27T18_48_11_257Z-debug.log
------
executor failed running [/bin/sh -c npm install]: exit code: 1
ERROR: Service 'app' failed to build : Build failed
  • What’s in the error log? Have you tried switching the port? 3333 for another?

  • No, but to in this problem des of yesterday or be already turned off the pc if you had been using the hj port would not give the msm error to thinking that and file giving conflict

  • Could post the log?

  • renames to APP2 and tests

  • I’ve done it before,

  • the problem starts in RUN npm install

  • adds this flag npm install --unsafe-perm

  • 1

    add to dockerfile?

  • 1

    if it is I have already done and gave the same error that not to mention that the version Alpine comes without sudo.

Show 4 more comments

1 answer

-1

The problem was in the version of Node that was breaking application in the latest version.

FROM node:14

WORKDIR /usr/api/authentication

COPY package.json ./

RUN npm install

EXPOSE 3333

CMD ["npm", "run", "dev"]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.