Docker and NodeJS permission denied

I know, this question is not really about programming..

I have a ‘Alpine’ docker container, with a user ‘web’ I can install NodeJS, install some modules with npm install and start the dev server (or prod server).

  • docker-compose: links option not working
  • Nginx SSL inside a docker container
  • How do I define a Reverse Proxy to a docker windows container
  • Redirect different domains to the same apache using reverse proxy
  • How to choose to which network doing port mapping
  • “Hello World” with official nginx and php docker images. Howto?
  • But when I launch docker commit, the new image has the new directories, but ‘web’ has not the permission to cd or ls in the directories. Even with chmod as root, after that, my user obtains Permission denied on all the home dir… Like if the directories was corrupted.. (but I can browse it with root).

    I don’t want to launch the app with root.

    EDIT 2 : Finally, I have the same problem just with the following Dockerfile :

    FROM alpine:3.2
    RUN adduser -D web
    RUN echo "web   ALL=(ALL:ALL)   NOPASSWD:       ALL " > /etc/sudoers
    
    USER web
    WORKDIR "/home/web"
    
    ADD ./FOLDER /home/web
    EXPOSE 8080 5000
    

    And it doesn’t work too… Maybe it’s a problem with Alpine ?

    EDIT : with Dockerfile.
    I start from a Node BASE image which has the following operations :

    FROM alpine:3.2
    ENV NODE_VERSION=v4.2.4
    ENV NPM_VERSION=2
    
    RUN apk --update --virtual build_dependencies \
        make gcc g++ python linux-headers paxctl krb5-dev \
        automake autoconf nasm git curl file sudo binutils-gold && \
        apk add --update krb5-libs libgcc libstdc++ && \
    curl -sSL https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}.tar.gz | tar -xz && \
    
    cd /node-${NODE_VERSION} && \
        ./configure --prefix=/usr && \
        make -j $(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
        make install && \
        paxctl -cm /usr/bin/node && \
        rm -rf /etc/ssl /node-${NODE_VERSION}
    
    RUN cd / && \
        if [ -x /usr/bin/npm ]; then \
                npm install -g npm@${NPM_VERSION} && \
                find /usr/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf; \
        fi
    
    RUN rm -rf /usr/share/man /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp \
        /usr/lib/node_modules/npm/man /usr/lib/node_modules/npm/doc /usr/lib/node_modules/npm/html
    
    RUN adduser -D web
    ENV PATH $PATH:/home/web/node_modules/.bin
    

    From there, I execute some following operations :

    git config --global http.sslVerify false
    git clone "GIT_REPO"
    cd GIT_REPO
    git checkout dev
    npm config set strict-ssl false
    git config --global http.proxy "PROXY"
    git config --global https.proxy "PROXY
    npm config set proxy "PROXY"
    npm config set https-proxy "PROXY"
    npm install --production
    npm install forever
    

    But if I create myself a directory ‘/home/web/TEST’, ‘web’ is able to browse, even after a commit. I remove too all specified .git files before install with npm.

  • Docker & Angular 2 : binded directory remains empty
  • Docker Remote API to login to registry
  • Why hadoop services exits immediately?
  • What's the meaning of docker hub's url design?
  • Improving java web app deployment process inside a docker container
  • Apache container freezes due to locked file on shared volume using Docker for Windows
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.