title: Command not found in container
body: <p>Inside of a docker container I run a python script. My <code>Dockerfile</code> looks as follows</p>
  <pre><code>FROM ubuntu:18.04
  
  WORKDIR /ingestion
  COPY /services/bcp /ingestion/services/bcp
  
  RUN mkdir -p /tmp/ingestion &amp;&amp; \
      chmod +x /ingestion/bcp-build.sh &amp;&amp; \
      /ingestion/bcp-build.sh
  
  ENTRYPOINT [&quot;python3&quot;, &quot;-m&quot;, &quot;services.bcp&quot;]
  </code></pre>
  <p>Inside of <code>bcp-build.sh</code> I install <code>bcp</code> tool for linux:</p>
  <pre><code>apt-get update
  apt-get upgrade -y
  apt-get install -y curl
  
  curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 
  curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/msprod.list 
  
  apt-get update
  ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev 
  echo 'export PATH=&quot;$PATH:/opt/mssql-tools/bin&quot;' &gt;&gt; ~/.bash_profile
  echo 'export PATH=&quot;$PATH:/opt/mssql-tools/bin&quot;' &gt;&gt; ~/.bashrc
  source ~/.bash_profile
  source ~/.bashrc
  </code></pre>
  <p>To run the container I use <code>docker-compose.yml</code></p>
  <pre><code>version: &quot;3&quot;
  services:
      bcp: 
          build: .
  </code></pre>
  <p>The python (a sample piece of code over here) looks like this:</p>
  <pre><code>import argparse
  
  arg_parser: argparse = argparse. \
     ArgumentParser(
         description=&quot;Extract tables to CSV&quot;,
         usage=&quot;bcp.py [-h] [--database [str]]&quot;
     )
  required_args: argparse = arg_parser.add_argument_group(&quot;required arguments&quot;)
  required_args.add_argument(&quot;--database&quot;, metavar=&quot;str&quot;, type=str, help=&quot;database from where to extract&quot;, required=True)
  
  def foo():
     args: argparse = arg_parser.parse_args()
     database = args.database
     print(database)
  
     # build bcp cmd 
     cmd: str = f&quot;bcp {database}.table out /tmp/ingestion/foo.csv&quot;
     subprocess.run(cmd, shell=True) # execute it via subprocess
  
  foo()
  </code></pre>
  <p>To create the image and use it, I run the following commands, <code>docker-compose up -d --build -t foo</code>. It works. But, when I try to execute <code>python</code> code it does not recognise the <code>bcp</code> command. It says <strong>bcp command not found</strong>. Could you please instruct, how to mitigate this issue?</p>
  <p>The <strong>exact</strong> error message is <strong>&quot;bcp command not found&quot;</strong>.</p>
  <p>Interestingly enough, when I run <code>docker run -it --rm --entrypoint bash foo</code>, and execute <code>bcp</code> then the command is available.</p>