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

  • “unauthorized: Unauthorized” message when pushing Docker container to Bluemix
  • Docker how to run pip requirements.txt only if there was a change?
  • How can I prevent url re-writing in EventStore using Docker?
  • Docker container prefer host eth0 over wlan0 for internet
  • NodeJS is not reacting to changes inside a Docker Container
  • Using Docker for JBOSS EAP and Oracle DB
  • 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
    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${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; \
    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.

  • Use non-virtual folder in Docker compose as volume
  • docker 1.12 swarm : Does Swarm have a configuration store like kubernetes configMap
  • Packaging a docker host as an OVA/OVF
  • How to get the Docker Container Id from inside a running docker image via Java API?
  • can't run docker container with simple node app example in bluemix
  • Using docker for unit test
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.