title: Docker - parent image execution fails due to missing root access
body: <p>The parent image I am using seems to require root access to run its <code>ENTRYPOINT</code> instruction. </p>
  
  <p>In my <code>Dockerfile</code> I need to run my own container (executable) with normal user at the end. How do I switch back and forth between users here?</p>
  
  <p>Psuedo Dockerfile:</p>
  
  <pre><code>FROM parentrepo/parentimg # its Dockerfile probably has ENTRYPOINT at the end which requires root access
  #my app specific instructions
  WORKDIR ..
  RUN mkdir ..
  COPY ..
  RUN tar ..
  EXPOSE 9000
  USER nir # HEre i want to switch user to nir
  WORKDIR ${myhome}
  CMD ["/bin/bash", "-c", "./start"]
  </code></pre>
  
  <p>Running above fails as parent requires sudo access. if I don't do <code>USER nir</code> then my process starts as root user which i don't want. Does the parent Dockerfile need to have <code>USER root</code> here ?</p>
  
  <p>Also, Is there any document that describe how docker <code>Build</code> execute instructions at high level? . How it interacts with hierarchies of parent Dockerfiles. Looks like it imports instructions from parent docker files; creates one docker file. Does it reorder instruction in anyway?</p>
  
  <p>ANd what happens at runtime which executing via <code>docker run</code> ? I know <code>RUN</code> command is used at build time while <code>CMD</code> and <code>ENTRYPOINT</code> executed at runtime but it still doesn't explain whole picture and sequences from build otherwise it would have been clear what I need to do. </p>