Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Building Docker image on Linux fails when pulling verdaccio/verdaccio image #3683

Closed
1 task
jfreitas-dev opened this issue Mar 15, 2023 · 7 comments
Closed
1 task
Labels

Comments

@jfreitas-dev
Copy link

Your Environment

  • verdaccio version: 5.22.1
  • node version: 18.14.0
  • package manager: npm@9.3.1
  • os: linux + mac
  • platform: docker

Describe the bug

When pulling the verdaccio/verdaccio docker image on a linux system the build fails due to high container ids being mapped as uid's.

It seems its possible the issue has to do with specific npm versions and userns mapping within docker + linux. When the uid is too high, linux has issues. I have supplied some articles below that lead me in that direction.

To Reproduce
Running locally on a Mac and Docker does not replicate this issue and I have not found a way to do so.
I have started to run into the issue when deploying via linux containers in both Bitbucket pipelines during build and Azure Web Apps during deployment as they both use Linux environments

  • How to reproduce the issue
    Build a docker image within a linux environment from the verdaccio/verdaccio base image

  • Steps to reproduce the issue

Dockerfile

FROM verdaccio/verdaccio:5
ARG VERDACCIO_CONFIG_PATH
ARG VERDACCIO_PLUGINS
ADD ${VERDACCIO_CONFIG_PATH} /verdaccio/conf/config.yaml
USER root
RUN npm install --global ${VERDACCIO_PLUGINS}
ENV VERDACCIO_USER_UID=10001
USER $VERDACCIO_USER_UID

docker-compose.yaml

services:
  package-manager:
    build:
      context: .
      args:
        - VERDACCIO_CONFIG_PATH=config.yaml
        - VERDACCIO_PLUGINS=verdaccio-azure-ad-login
    container_name: package-manager
    environment:
      - VERDACCIO_PORT=4873
      - VERDACCIO_USER_UID=10001
      - AZURE_TENANT_ID
      - AZURE_APP_REG_SECRET
      - AZURE_APP_REG_ID
    ports:
      - 4873:4873
    image: mypackagemanager.io:latest
    volumes:
      - "/verdaccio/storage"
      - "/verdaccio/config"
      - "/verdaccio/plugins"

Command to get error:

docker-compose build

Expected behavior

The build should not error when pulling images

Screenshots, server logs, package manager log

image

Some links I have found while attempting to debug this problem:

Configuration File (cat ~/.config/verdaccio/config.yaml)

config.yaml

storage: /verdaccio/storage/data
plugins: /verdaccio/plugins
web:
  title: Lous Supreme Private Registry
  darkMode: true
auth:
  htpasswd:
    file: ./htpasswd
    algorithm: bcrypt
    rounds: 10
  azure-ad-login:
    # REQUIRED, Azure application tenant
    tenant: ${AZURE_TENANT_ID}
    # REQUIRED, Azure client_id
    client_id: ${AZURE_APP_REG_ID}
    # REQUIRED, Azure application client_secret
    client_secret: ${AZURE_APP_REG_SECRET}
uplinks:
  npmjs:
    url: https://registry.npmjs.org/
packages:
  "@*/*":
    # scoped packages
    access: $all
    publish: $authenticated
    unpublish: $authenticated
    # proxy: npmjs
  "**":
    access: $all
    publish: $authenticated
    unpublish: $authenticated
server:
  keepAliveTimeout: 60
middlewares:
  audit:
    enabled: true
log: { type: stdout, format: pretty, level: http }

Environment information

Environment Info:
System:
OS: Linux 5.10 Alpine Linux
CPU: (6) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
npm: 9.3.1 - /usr/local/bin/npm
npmGlobalPackages:
verdaccio: 5.22.1

Contribute to Verdaccio

  • I'm willing to fix this bug 🥇
@juanpicado
Copy link
Member

juanpicado commented Mar 15, 2023

I don´t know but maybe you can increase logging https://github.com/verdaccio/verdaccio/wiki/Debugging-Verdaccio#debugging-with-debug and see if you get more info

@jfreitas-dev
Copy link
Author

The issue occurs when pulling the image. I'm not sure adding the debugging tool would do much. Is there a verdaccio v5 image available built with node:16 rather than node:18?

@juanpicado
Copy link
Member

My reply was not for this ticket :)

@juanpicado
Copy link
Member

Is there a verdaccio v5 image available built with node:16 rather than node:18?

No, there is only one.

@juanpicado
Copy link
Member

It works for me with your example CPU: (10) arm64 Apple M1 Pro, I've removed image: mypackagemanager.io:latest because I have no idea what it is.

 docker-compose build
[+] Building 7.5s (8/8) FINISHED                                                                                                                                       
 => [internal] load build definition from Dockerfile                                                                                                              0.0s
 => => transferring dockerfile: 32B                                                                                                                               0.0s
 => [internal] load .dockerignore                                                                                                                                 0.0s
 => => transferring context: 2B                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/verdaccio/verdaccio:5                                                                                                  0.0s
 => [internal] load build context                                                                                                                                 0.0s
 => => transferring context: 7.35kB                                                                                                                               0.0s
 => CACHED [1/3] FROM docker.io/verdaccio/verdaccio:5                                                                                                             0.0s
 => [2/3] ADD config.yaml /verdaccio/conf/config.yaml                                                                                                             0.0s
 => [3/3] RUN npm install --global verdaccio-azure-ad-login                                                                                                       7.3s
 => exporting to image                                                                                                                                            0.0s 
 => => exporting layers                                                                                                                                           0.0s
 => => writing image sha256:ff74b81ca49f776c4b2fe891710fc385bab726c956a49aba2a8096eb7e64ea42                                                                      0.0s
 => => naming to docker.io/library/docker-package-manager     

@jfreitas-dev
Copy link
Author

Yeah it builds on Mac just fine for me as well - its when its being built or pulled on a linux machine that causes the issues. I believe if im reading this npm ticket correctly, it occurs when using a 9.x version of npm below 9.5.1.

@juanpicado
Copy link
Member

Ok than is an external issue nothing I can do about it, but good to have a reference if others encounter this problem

@juanpicado juanpicado added external-issue topic: npm node package managers labels Mar 16, 2023
@verdaccio verdaccio locked and limited conversation to collaborators Mar 18, 2023
@juanpicado juanpicado converted this issue into discussion #3686 Mar 18, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

2 participants