ENV variable isn't added correctly to the container environment

Here is my Dockefile

FROM ubuntu:latest

MAINTAINER mazzy

WORKDIR /tmp

RUN apt-get update && apt-get install -y wget
RUN wget http://nodejs.org/dist/v0.12.0/node-v0.12.0-linux-x64.tar.gz
RUN tar xvf node-v0.12.0-linux-x64.tar.gz

RUN cp -r node-v0.12.0-linux-x64 /usr/local/

WORKDIR /usr/local
RUN ln -s /usr/local/node-v0.12.0-linux-x64.tar.gz /usr/local/node

# FIX HERE
ENV PATH /usr/local/node/bin:$PATH

RUN npm install -g bower

EXPOSE 8080:8080

The problem with this Dockerfile is that when I run it I got the error npm not found. This is probably caused by the fact that the installation folder isn’t added correctly to the PATH env variable.

  • Failed to connect to github.com port 443: Connection refused, Failed to Bootstrap, Discourse Docker
  • docker local host url not opening
  • Hazelcast TCP/IP discovery on DCOS/ Marathon and docker
  • Running Docker Oracle Container with different databases
  • How to get two Docker containers talking to each other?
  • Kubernetes pod fails while making call to google cloud pub/sub with unknown certificate autority
  • Do you know why?

  • Debug rails app inside docker use Intellij/Rubymine
  • How to assign IPv6 address with docker-compose
  • Docker Alpine Texlive
  • docker exec bash in windows - keyboard arrow keys don't work
  • How can I keep docker container alive long enough for New Relic send traced exceptions?
  • JVM release unused heap
  • One Solution collect form web for “ENV variable isn't added correctly to the container environment”

    Your created symlink is invalid. Your /usr/local/node is pointing to a non existing file. You have to leave out the .tar.gz.

    Apart from that I recommend using the node:onbuild docker image as your basis. It was created as a building block for your own node application and already includes a proper setup of node.js and npm.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.