title: how to edit a file via Dockerfile
body: <p>I am trying to create a Dockerfile to setup my hadoop environment.
  In one of the steps I need to add some lines to my bashrc file. This is what I am doing:</p>
  
  <pre><code>RUN wget http://apache.mirror.digitalpacific.com.au/hadoop/common/current/hadoop-2.7.2.tar.gz
  RUN tar -zxvf hadoop-2.7.2.tar.gz
  RUN cp -R hadoop-2.7.2 /usr/local/hadoop
  RUN cd /usr/local/hadoop
  RUN cat &lt;&lt; EOF &gt;&gt; ~/.bashrc
  export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
  export HADOOP_INSTALL=/usr/local/hadoop
  export PATH=$PATH:$HADOOP_INSTALL/bin
  export PATH=$PATH:$HADOOP_INSTALL/sbin
  export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
  export HADOOP_COMMON_HOME=$HADOOP_INSTALL
  export HADOOP_HDFS_HOME=$HADOOP_INSTALL
  export YARN_HOME=$HADOOP_INSTALL
  export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
  export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
  EOF
  RUN source ~/.bashrc
  </code></pre>
  
  <p>However I am getting the error below:</p>
  
  <pre><code>Step 10 : EXPORT
  Unknown instruction: EXPORT
  </code></pre>
  
  <p>Any idea how can I edit my bashrc file?</p>
  
  <p><strong>NOTE:</strong></p>
  
  <p>I also tried:</p>
  
  <pre><code>ENV JAVA_HOME /usr/lib/jvm/java-1.7.0-openjdk-amd64
  ENV HADOOP_INSTALL /usr/local/hadoop
  ENV PATH $PATH:$HADOOP_INSTALL/bin
  ENV PATH $PATH:$HADOOP_INSTALL/sbin
  ENV HADOOP_MAPRED_HOME $HADOOP_INSTALL
  ENV HADOOP_COMMON_HOME $HADOOP_INSTALL
  ENV HADOOP_HDFS_HOME $HADOOP_INSTALL
  ENV YARN_HOME $HADOOP_INSTALL
  ENV HADOOP_COMMON_LIB_NATIVE_DIR $HADOOP_INSTALL/lib/native
  ENV HADOOP_OPTS "-Djava.library.path=$HADOOP_INSTALL/lib"
  </code></pre>
  
  <p>and</p>
  
  <pre><code>RUN echo $'export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64' &gt;&gt; ~/.bashrc
  RUN echo $'export HADOOP_INSTALL=/usr/local/hadoop' &gt;&gt; ~/.bashrc
  RUN echo $'export PATH=$PATH:$HADOOP_INSTALL/bin' &gt;&gt; ~/.bashrc
  RUN echo $'export PATH=$PATH:$HADOOP_INSTALL/sbin' &gt;&gt; ~/.bashrc
  RUN echo $'export HADOOP_MAPRED_HOME=$HADOOP_INSTALL' &gt;&gt; ~/.bashrc
  RUN echo $'export HADOOP_COMMON_HOME=$HADOOP_INSTALL' &gt;&gt; ~/.bashrc
  RUN echo $'export HADOOP_HDFS_HOME=$HADOOP_INSTALL' &gt;&gt; ~/.bashrc
  RUN echo $'export YARN_HOME=$HADOOP_INSTALL' &gt;&gt; ~/.bashrc
  RUN echo $'export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native' &gt;&gt; ~/.bashrc
  RUN echo $'export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"' &gt;&gt; ~/.bashrc
  </code></pre>
  
  <p>still no success</p>