Permission denied when trying to run an executable in a Docker container

Viewed 16

I'm trying to make an Express server with access to sqlPackage for DACPAC-deployments.

This is the final stage in my Docker build:

FROM node:16-alpine
WORKDIR /usr/app
ARG SQLPACKAGE_URL=https://download.microsoft.com/download/f/0/9/f091c731-45be-48fa-ae84-bc28388e3ef8/sqlpackage-linux-x64-en-16.0.6161.0.zip
# Install sqlPackage
RUN apk add --no-cache wget unzip 
RUN wget -progress=bar:force -q -O sqlpackage.zip $SQLPACKAGE_URL \
    && unzip -qq sqlpackage.zip -d /usr/app/sqlpackage \
    && chmod 777 /usr/app/sqlpackage \
    && chown -R node.node /usr/app/sqlpackage
COPY --from=ts-remover /usr/app ./
USER node
CMD ["main.js"]
ARG PORT=8080
EXPOSE $PORT

My node project cannot run the executable though. I've tried running it manually from within the container, but I get permission denied there too.

/usr/app $ whoami
node
/usr/app $ ls -l
total 41272
drwxrwxrwx    2 node     node         20480 Sep 12 14:12 sqlpackage
/usr/app $ ./sqlpackage
/bin/sh: ./sqlpackage: Permission denied

Why can I not execute this file, even though the permissions seem to be correct?

0 Answers
Related