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.

  • edit docker container files with OS X Sublime Text
  • How could I enable docker remote api on mac osx
  • mysql docker container get remote host: Connection refused after container running
  • Docker, no IPAddress in docker inspect
  • Jenkins run external script with docker command
  • How to use Nomad with Nvidia Docker?
  • Do you know why?

  • “cp: Command not found” when recreating and extending centos6-i386 Docker base image
  • Docker stack deploy rolling updates volume issue
  • file system issue when i use vagrant+docker on windows
  • LogStash container restarts on Kube pod
  • Docker-compose recommended way to use data containers
  • How to mount the volume of host to docker container with executable file permission using docker api
  • 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.