title: Docker. Exec npm command in different folder
body: <p>I want to run <code>npm install</code> command in container.
  But simple: <code>docker exec container npm install</code> is not the right thing for me.</p>
  
  <p>I want to run this command in <code>/home/client</code> but my working directory in container is <code>/home</code></p>
  
  <p>Is that possible?
  I don't want to enter container and I don't want to change working environment.</p>
  
  <p><strong>Edit 1</strong>
  Dockerfile:</p>
  
  <pre><code>FROM ubuntu:16.04
  COPY . /home
  WORKDIR /home
  RUN apt-get update &amp;&amp; apt-get install -y \
      python-pip \
      postgresql \
      rabbitmq-server \
      libpq-dev \
      python-dev \
      npm \
      mongodb
  RUN pip install -r requirements.txt
  </code></pre>
  
  <p>Docker run command:</p>
  
  <pre><code>docker run \
  -tid \
  -p 8000:8000 \
  -v $(PWD):/home \
  --name container \
  -e DB_NAME \
  -e DB_USER \
  -e DB_USER_PASSWORD \
  -e DB_HOST \
  -e DB_PORT \
  container
  </code></pre>
  
  <p>Two commands in order to prove there is a directory <code>/home/client</code>:</p>
  
  <pre><code>docker exec container pwd
  </code></pre>
  
  <p>Gives: <code>/home</code></p>
  
  <pre><code>docker exec container ls client
  </code></pre>
  
  <p>Gives: </p>
  
  <pre><code>node_modules
  package.json
  src
  webpack.config.js
  </code></pre>
  
  <p>That's node modules from my host.</p>
  
  <p><strong>Edit 2</strong>
  When run:</p>
  
  <pre><code>docker exec container cd /home/client
  </code></pre>
  
  <p>It produces the following error:</p>
  
  <blockquote>
    <p>rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"cd\": executable file not found in $PATH"</p>
  </blockquote>