title: "sqlplus": executable file not found in $PATH" when running a command with docker exec
body: <p>I want to start a Docker-container with Oracle XE and then run an SQL script (ddl.sql) to create some tables.</p>
  
  <p>If I execute all the steps separately, everything works:</p>
  
  <pre><code>$ docker run -d --name db --rm -p 49161:1521 -v "C:/data/workspace/vpk/":/home/vpk -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g
  </code></pre>
  
  <p>Run a terminal in container:</p>
  
  <pre><code>$ docker exec -it db bash
  </code></pre>
  
  <p>Execute the script:</p>
  
  <pre><code>root@f3ae34d554af:/# echo exit | sqlplus system/oracle@xe @/home/vpk/ddl.sql
  </code></pre>
  
  <p>However when I tried to combine the last two steps into one:</p>
  
  <pre><code>$ docker exec db sqlplus system/oracle@xe @/home/vpk/ddl.sql
  </code></pre>
  
  <p>I got the error:</p>
  
  <pre><code>OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"sqlplus\": executable file not found in $PATH": unknown
  </code></pre>
  
  <p>Using the full path of sqlplus didn't help either:</p>
  
  <pre><code>$ docker exec db bash -c "/u01/app/oracle/product/11.2.0/xe/bin/sqlplus system/oracle@xe /home/vpk/ddl.sql"
  Error 6 initializing SQL*Plus
  SP2-0667: Message file sp1&lt;lang&gt;.msb not found
  SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
  </code></pre>
  
  <p>What is the reason of the error?</p>
  
  <p>With the help of @maxm I was able to successfully run:</p>
  
  <pre><code>docker exec -it db /bin/bash -c "ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe /u01/app/oracle/product/11.2.0/xe/bin/sqlplus system/oracle@xe @/home/vpk/ddl.sql"
  </code></pre>
  
  <p>However I would like to exit the sqlplus prompt afterwards. But when I tried to add <code>echo exit</code> to it and run:</p>
  
  <pre><code>docker exec -it db /bin/bash -c "ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe; echo exit | /u01/app/oracle/product/11.2.0/xe/bin/sqlplus system/oracle@xe @/home/vpk/ddl.sql"
  </code></pre>
  
  <p>I got the error:</p>
  
  <pre><code>Error 6 initializing SQL*Plus
  SP2-0667: Message file sp1&lt;lang&gt;.msb not found
  SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
  </code></pre>