Docker nodejs not found

When i run docker build -t example . on the below im getting an error

FROM ruby:2.1
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
ENV NVM_DIR /usr/local/nvm

RUN curl | bash \
  && source $NVM_DIR/ \
  && nvm install $NODE_VERSION \
  && nvm alias default $NODE_VERSION \
  && nvm use default


RUN node -v

I get the following error:

  • How to set Puma workers, threads for Rails in Docker
  • How to make docker container to be accessed only in intranet
  • How to replace a Docker data volume with another at runtime?
  • How to install a python package with all the dependencies into a Docker image?
  • Identifying files contained within a docker image (or Application dependencies)
  • Packer instance accessing private Docker registry in AWS
  • Step 9 : RUN node -v —> Running in 6e3fac36d2fc /bin/sh: node:
    command not found The command ‘/bin/sh -c node -v’ returned a non-zero
    code: 127

    Can’t understand why node is not found in the path. i tried executing the file as well but it didnt have an effect.

  • Getting error when running mocha test with Xvfb and firefox headlessly in a docker container
  • Fork docker repository
  • Deploy Java EE application to payara41 docker container using maven
  • Flag provided but not defined -d while running docker container
  • Api-Testing getting a mess with vagrant
  • First execution of Docker on a new EC2 Jenkins Slave does not work
  • One Solution collect form web for “Docker nodejs not found”

    Node version manager is an excellent application for switching versions of Node.js on your development machine, but Docker begs a specific kind of image/container design that is meant to be both ephemeral and stripped down to the bare essentials in order to support the “best practice” of microservices. Docker is just a fancy way to run a process, not a full VM. That last sentence has helped me a lot in how to think about Docker. And so here, you can make things easier on yourself by creating different versions of your image, instead of making one container with many versions of Node.js inside of it. This way, you can reference the Node version you want to run inside of your docker run command instead of trying to feed in environment variables trying to get NVM to select the right version. For example:

    docker build -t=jamescharlesworth-node:4.x-latest .

    And of course your Dockerfile will have in it the install command in your RUN directive that you mention in the comments:

    RUN curl -sL | bash - 
    RUN apt-get install -y nodejs
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.