title: Keeping container alive with Docker Python SDK
body: <p>I am using the Docker Sdk for Python to run my container.</p>
  
  <p>I am trying to start a docker container, and then run a command using the api exec_run (I need the exit code). 
  The exec_run needs to be executed on a started container.</p>
  
  <p>This is my code:</p>
  
  <pre><code>import docker
  
  client = docker.from_env()
  container = client.containers.run('e7d8452ce5f5', command="echo starting", detach=True)
  container.exec_run("echo execute command")
  </code></pre>
  
  <p>This raises an exception:</p>
  
  <pre><code>docker.errors.APIError: 409 Client Error: Conflict ("Container b65acd40f589819f490564dcb4e25f3055d85712cb7b2834ede5f2c4d57f2da6 is not running")
  </code></pre>
  
  <p>I tried running with no command when invoking client.containers.run, same exception..</p>
  
  <p>Seems the container exists when the command is finished, even though in their documentation it is stated that the command run with detach=True is same as the cli docker run -d (when using docker run -d the container stays alive)</p>
  
  <p>Any ideas on how to keep the container alive in order to call exec_run on it?</p>