npm / npm/cli

[BUG] Version npm@9.1.1 incompatible with Docker when userns-remap feature is enabled

Open
#5,900 3 comments 4 reactions 1 assignee View on GitHub

@nlf is already working on this.

Since Feb 16, 2023.

Bug Priority 2 Release 9.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior
FROM node:18.12.1-alpine AS base
WORKDIR /app
EXPOSE 3000

FROM node:18.12.1-alpine AS build
WORKDIR /src
COPY "FMC.GTMP.Twix.PDP.Web.Mock/Client/src" "temp/src"
COPY "FMC.GTMP.Twix.PDP.Web.Mock/Client/public" "temp/public"
COPY "FMC.GTMP.Twix.PDP.Web.Mock/Client/package.json" "temp/package.json"
COPY "FMC.GTMP.Twix.PDP.Web.Mock/Client/webpack.config.js" "temp/webpack.config.js"
WORKDIR /src/temp
RUN apk update
RUN npm install -g npm@9.1.1
RUN npm install

FROM base AS final
WORKDIR /app
ENV NODE_ENV production
COPY --from=build /src/temp ./

ENTRYPOINT ["npm", "run", "start"]

When enabling the userns-remap Docker feature and installing any NPM version above 9.1.1, the image TAR extraction process fails.

ERROR - failed to register layer: Error processing tar file(exit status 1): Container ID 369884941 cannot be mapped to a host IDErr: 0, Message: failed to register layer: Error processing tar file(exit status 1): Container ID 369884941 cannot be mapped to a host ID

Expected Behavior

The Docker image builds, the docker container starts successfully and the app is shown in the browser.

Steps To Reproduce
  1. Docker engine is running
  2. Enable the docker feature userns-remap
  3. Build the docker image based on the docker file content shared above
Environment
  • npm: 9.1.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.