title: Activate anaconda environment within docker container
body: <p>I am trying to programatically (within Python) replicate the anaconda environment I am working in locally in a Docker container. However, I want to make one Docker image capable of doing this for an arbitrary environment. I see the process looking something like:</p>
  
  <ol>
  <li>Within my local environment, export the anaconda environment I am working in by using the <code>subprocess</code> Python module to run <code>conda env export &gt;&gt; environment.txt</code>.</li>
  <li>Start up my Docker container (whose base image is <code>continuumio/anaconda:latest</code>), providing it the <code>environment.txt</code>. The python file the container runs should operate within the Anaconda environment specified by that <code>environment.txt</code>. </li>
  </ol>
  
  <p>I know how to do step 1, but I don't see how I could do step 2; how can I, within a Python script, update the anaconda environment (and install the missing packages) in which it operates?</p>