Search code examples
node.jsdockerazcopy

Running azcopy inside docker container throws spawn EACCES error


I've created the following docker file:

FROM node:12.14.0-alpine
RUN apk upgrade --update-cache --available && \
    apk add openssl && \
    apk add --no-cache --virtual python libc6-compat make g++ pkgconf libsecret-dev && \
    rm -rf /var/cache/apk/*

RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
WORKDIR /app

COPY . .

RUN npm install --registry https://registry.npmjs.org @azure-tools/azcopy-node

EXPOSE 8080
CMD ["npm", "run", "start"]

When running an azcopy command inside the container i'm getting the following error:

spawn /app/node_modules/@azure-tools/azcopy-linux/dist/bin/azcopy_linux_amd64 EACCES

How can I fix it?


Solution

  • I had to add permissions to the azprocess in the docker file, now it works:

    FROM node:12.14.0-alpine
    RUN apk upgrade --update-cache --available && \
        apk add openssl && \
        apk add --no-cache --virtual python libc6-compat make g++ pkgconf libsecret-dev && \
        rm -rf /var/cache/apk/*
    
    RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
    WORKDIR /app
    
    COPY . .
    
    RUN npm install --registry https://registry.npmjs.org @azure-tools/azcopy-node
    RUN chmod a+x /app/node_modules/@azure-tools/azcopy-linux/dist/bin/azcopy_linux_amd64
    
    EXPOSE 8080
    CMD ["npm", "run", "start"]