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).

  • How can i add a command to the meteor mupx start script?
  • “certificate verify failed” when connecting docker-compose to IBM Container Cloud
  • Docker image is not visible through the Remote Docker API
  • How to get root privilege in Docker container?
  • Intrigue.io with Docker
  • Stop Minecraft server in Docker when container stops
  • 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.

  • How to check nvidia-docker version?
  • Cannot connect to the Docker daemon (port 2375)
  • Cannot get a valid response from Docker Registry remote API
  • Cannot produce message to kafka from service running in docker
  • App running in Docker container on port 4567 can't be accessed from the outside
  • Packer,Dockramp vs Dockerfile
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.