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.

  • Using docker-compose to collaborate on existing git repo Django project
  • Create Docker image from existing Ubuntu + App
  • What is a Dockerfile.dev and how is it different from Dockerfile
  • Can't mount all files to docker container volume
  • GC overhead limit exceeded in Docker when trying to build project by sbt
  • exec is no use ,I do not know how to solve
  • Do you know why?

  • Can docker “instance” run totally in ram?
  • Auto-synch data in container upon changes in host
  • Not dockerized nginx load balancing to gitlab dockerized
  • Hadoop cluster with docker swarm
  • Docker, How to replace capistrano tasks in docker
  • Kafka in Kubernetes Cluster- How to publish/consume messages from outside of Kubernetes Cluster
  • 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.