empty PATH returned when entering new Docker image

I have written a Dockerfile for building a docker image:

#author russell jarvis rjjarvis@asu.edu

#start from the serial version of ubuntu NEURON+Python as if its a module
# add mpi support


#NEURON Dockerfile
#Docker comments must be of this form.
# This is the syntax for a directive. Don’t get confused
#Set the base image to pyneuron-toolbox


FROM russelljarvis/pyneuron-toolbox
RUN echo $PATH


WORKDIR $HOME
RUN sudo /opt/conda/bin/conda install -y mpi4py ipython
RUN echo $PATH


WORKDIR /home/docker

RUN \
   sudo wget https://www.open-mpi.org/software/ompi/v2.0/downloads/openmpi-2.0.0.tar.gz && \
   sudo tar -xzf openmpi-2.0.0.tar.gz && \
   sudo rm openmpi-2.0.0.tar.gz
RUN echo $PATH

WORKDIR /home/docker/openmpi-2.0.0


RUN \
  sudo ./configure && \
  sudo make all && \
  sudo make install

RUN echo $PATH

#Download  maven, and its java dependencies

WORKDIR $HOME/git
RUN sudo apt-get -y install default-jre default-jdk maven

RUN echo $PATH


WORKDIR /home/docker/neuron/nrn-7.4



RUN sudo ./configure --prefix=`pwd` --without-iv --with-nrnpython=/opt/conda/bin/python --with-paranrn=/usr/bin/mpiexec
RUN sudo make all && \
   sudo make install

RUN echo $PATH

WORKDIR src/nrnpython
RUN sudo /opt/conda/bin/python3.4 setup.py install

RUN echo $PATH
RUN echo "its chowning the USER directory that seems to break path" 
#RUN sudo chown -R docker $HOME
RUN echo $PATH
WORKDIR /home/docker/git
#RUN git clone https://github.com/NeuroML/jNeuroML
RUN git clone https://github.com/russelljjarvis/jNeuroML.git
WORKDIR jNeuroML
RUN sudo /opt/conda/bin/python getNeuroML.py
ENV ADDITIONAL_PATH="/neuron/nrn-7.4/x86_64/bin"
CMD export PATH=$PATH:$ADDITIONAL_PATH; /bin/echo -e "ADDITIONAL_PATH is $ADDITIONAL_PATH\nPATH is $PATH"
RUN echo $PATH
RUN echo $ADDITIONAL_PATH

#WORKDIR /home/docker/git
#RUN git clone

I build the image specified by the Dockerfile with

  • Determine if new docker container available on docker hub
  • docker run container, how to rerun
  • Can't connect to MySQL docker container
  • Docker CMD to start Haproxy in Dockerfile
  • Docker inside Docker (without command line) [duplicate]
  • How to set up a LAMP stack in Debian containers using Docker Compose?
  • $docker build .
    

    I find the IMAGE ID for the latest build and enter it using:

    $docker run -it d10bd1b2c2bb /bin/bash
    

    However when I enter the docker image I find that the content of environmental variable PATH is empty.

    The final commands are:

    ENV ADDITIONAL_PATH="/neuron/nrn-7.4/x86_64/bin"  
    CMD export PATH=$PATH:$ADDITIONAL_PATH; /bin/echo -e "ADDITIONAL_PATH is $ADDITIONAL_PATH\nPATH is $PATH"
    RUN echo $PATH  
    RUN echo $ADDITIONAL_PATH
    

    The outputs of the RUN echo statements are appropriate. The docker environmental variables seem fine when in the process of building the image, however, the problem only seems to arise when I enter the docker image.

    If those final Docker commands are omitted, the PATH variable is still an empty string when I enter into the freshly minted image.

    I wonder if anyone knows what is going wrong?

    Thanks for any suggestions.

  • Mounting directory from windows machine to OracleVMBox for Tensor on Docker
  • Docker - Bash: IP: command not found
  • How to check the docker-compose file version?
  • Unable to run java Program. Error inside docker
  • Docker maven plugin
  • Linking exposed port of docker with with the default nginx port
  • One Solution collect form web for “empty PATH returned when entering new Docker image”

    Only statements similar in form to the following:
    ENV PATH /opt/conda/bin/conda:/opt/conda/bin/python:$PATH
    should be used to set an environmental variable.
    The path variable can then be checked with:
    RUN echo $PATH
    during the build, however commands like
    conda and python may not work as expected during the build process, however the PATH variable will be updated properly when you enter the docker image.

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