Skip to content

Unable to authenticate with private registry inside docker container #47

@akash-rajput

Description

@akash-rajput

Using node:10.16.3-alpine image for docker container.
Package version: v0.1.1

After using:
RUN npm-cli-login -u ${NPM_REGISTRY_USERNAME} -p ${NPM_REGISTRY_PASSWORD} -e ${NPM_REGISTRY_EMAIL} -r ${NPM_REGISTRY} -s ${NPM_REGISTRY_SCOPE} --config-path ${NPM_CONFIG_FILE}
Config file exists & login succeeds. However on npm install the authentication fails.

Here's the content of Dockerfile:

FROM node:10.16.3-alpine
# install dependencies

ARG NPM_REGISTRY_USERNAME
ARG NPM_REGISTRY_PASSWORD
ARG NPM_REGISTRY_EMAIL
ARG NPM_REGISTRY
ARG NPM_REGISTRY_SCOPE
ARG NPM_CONFIG_FILE=.npmrc

RUN mkdir /service
RUN mkdir /service/build
RUN npm install -g npm-cli-login

WORKDIR /service
RUN ls

RUN npm-cli-login -u ${NPM_REGISTRY_USERNAME} -p ${NPM_REGISTRY_PASSWORD} -e ${NPM_REGISTRY_EMAIL} -r ${NPM_REGISTRY} -s ${NPM_REGISTRY_SCOPE} --config-path ${NPM_CONFIG_FILE}

ADD package.json ./
RUN ls
RUN npm install

# copy app source to image _after_ npm install so that
# application code changes don't bust the docker cache of npm install step
ADD build /service/build

# CMD [ "npm", "run", "start" ]

Here all the args are valid & authentication succeed with status 201.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions