Skip to content
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

Not able to build node14 image - /bin/sh: permission denied #1702

Open
sankarbabufk opened this issue Jul 21, 2021 · 0 comments
Open

Not able to build node14 image - /bin/sh: permission denied #1702

sankarbabufk opened this issue Jul 21, 2021 · 0 comments
Labels
area/permissions categorized differs-from-docker has-repro issue/build-fails issue/dockerfile-specific issue/permission-denied kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next. priority/p2 High impact feature/bug. Will get a lot of users happy works-with-docker

Comments

@sankarbabufk
Copy link

Actual behavior
Getting the below error while trying to build node14 image using kaniko executor

RUN npm test
cmd: /bin/sh
args: [-c npm test]
util.Lookup returned: &{Uid:100 Gid:65533 Username:app Name:app HomeDir:/home/app}
performing slow lookup of group ids for app
Running: [/bin/sh -c npm test]
error building image: error building stage: failed to execute command: starting command: fork/exec /bin/sh: permission denied

I am not facing the same issue when i build the same dockerfile using docker in my local machine.

Expected behavior
It should execute the command and show the result as below,

npm test

railinc-parse@1.0.0 test aws_lambda_scripts/railinc-parse
echo "Error: no test specified" && exit 0

Error: no test specified

To Reproduce
Steps to reproduce the behavior:

  1. Having the below stage in the jenkins deployment pipeline where we created config.json with auth credential and copy it inside /kaniko/.docker folder

stage("push") {
container('kaniko') {
dir(service){
sh("mkdir -p /kaniko/.docker/")
sh("cp ../config.json /kaniko/.docker/config.json")
sh("/kaniko/executor --cache=true --context=build/$service --destination=${REGISTRY_NAME}/$imageName:$imageTag --verbosity=debug")
}
}
}

Additional Information

  • Dockerfile

FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.8.4 as watchdog
FROM --platform=${TARGETPLATFORM:-linux/amd64} node:14-alpine as ship
ARG TARGETPLATFORM
ARG BUILDPLATFORM
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog
RUN apk --no-cache add curl ca-certificates
&& addgroup -S app && adduser -S -g app app
# Turn down the verbosity to default level.
ENV NPM_CONFIG_LOGLEVEL warn
RUN chmod 777 /tmp
USER app
RUN mkdir -p /home/app/function
# Wrapper/boot-strapper
WORKDIR /home/app
COPY package.json ./
# This ordering means the npm installation is cached for the outer function handler.
RUN npm i
# Copy outer function handler
COPY index.js ./
# COPY function node packages and install, adding this as a separate
# entry allows caching of npm install
WORKDIR /home/app/function
COPY function/*.json ./
RUN npm i
# COPY function files and folders
COPY function/ ./
# Run any tests that may be available
RUN npm test
# Set correct permissions to use non root user
WORKDIR /home/app/
ENV cgi_headers="true"
ENV fprocess="node index.js"
ENV mode="http"
ENV upstream_url="http://127.0.0.1:3000"
ENV exec_timeout="10s"
ENV write_timeout="15s"
ENV read_timeout="15s"
ENV prefix_logs="false"
HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
CMD ["fwatchdog"]

  • Build Context
    no dependent files
  • Kaniko Image (fully qualified with digest)
    containerTemplate(name: 'kaniko', image: "gcr.io/kaniko-project/executor:debug", ttyEnabled: true, command: "/busybox/cat")

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
  • No
Please check if the build works in docker but not in kaniko
  • Yes
Please check if this error is seen when you use --cache flag
  • Yes
Please check if your dockerfile is a multistage dockerfile
  • No
@aaron-prindle aaron-prindle added issue/permission-denied issue/dockerfile-specific kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next. priority/p2 High impact feature/bug. Will get a lot of users happy works-with-docker issue/build-fails area/permissions differs-from-docker has-repro categorized labels Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/permissions categorized differs-from-docker has-repro issue/build-fails issue/dockerfile-specific issue/permission-denied kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next. priority/p2 High impact feature/bug. Will get a lot of users happy works-with-docker
Projects
None yet
Development

No branches or pull requests

2 participants