title: How to source an entry point script with Docker?
body: <p>I have an Docker image and I can run it:</p>
  
  <pre><code>docker run -it --entrypoint="/bin/bash" gcr.io/docker:tag
  </code></pre>
  
  <p>Then I can source a script in the following way:</p>
  
  <pre><code>root@86bfac2f6ccc:/# source entrypoint.sh
  </code></pre>
  
  <p>The script looks like that:</p>
  
  <pre><code>more entrypoint.sh
  #!/bin/bash
  . /env.sh
  . /root/miniconda3/etc/profile.d/conda.sh
  conda activate base
  exec "$@"
  </code></pre>
  
  <p>Which activate the base env:</p>
  
  <pre><code>(base) root@86bfac2f6ccc:/#
  </code></pre>
  
  <p>So far so good but I don't managed to include this in the <code>Dockerfile</code> or as parameters to <code>docker run</code>:</p>
  
  <p>I tried many things:</p>
  
  <p>For example:</p>
  
  <pre><code>docker run -it --entrypoint="/bin/bash"  gcr.io/docker:tag  source entrypoint.sh
  /bin/bash: source: No such file or directory
  </code></pre>
  
  <p>But the script exist and can be executed:</p>
  
  <pre><code>docker run -it --entrypoint="/bin/ls"  gcr.io/docker:tag -la
  ...
  -rwxr-xr-x  1 root root   94 Apr 26 20:36 entrypoint.sh
  ...
  </code></pre>
  
  <p>Or:</p>
  
  <pre><code>docker run -it --entrypoint="/bin/bash"  gcr.io/docker:tag  ". /entrypoint.sh"
  /bin/bash: . /entrypoint.sh: No such file or directory
  </code></pre>
  
  <p>Or in the Docker file:</p>
  
  <pre><code>ENTRYPOINT ["source", "/entrypoint.sh"]
  </code></pre>
  
  <p>I guess the issue I have is maybe related the fact that <code>source</code> evaluate a script in the current shell.</p>
  
  <p>Any guidance to achieve what I want ? It seems quite obvious but I am out of idea.</p>