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.

  • How can you limit which users have Docker exec access in a shared environment?
  • Cannot connect externally to a docker container running CherryPy server
  • Linking to a Docker memcached container
  • php support for mongoDB
  • bash regular expressions to get docker container port number
  • Ansible docker_container etc_hosts with variable key
  • Do you know why?

  • How does one detect if one is running within a docker container within Python?
  • How to add private registry certs to Docker Machine
  • Redis Docker connection refused
  • Sharing a configuration file to multiple docker containers
  • Docker commit alterations of a built image
  • MPI in docker container over docker network hangs
  • 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.