title: The result of docker exec command
body: <p>I need to know in my shell script the output of some docker exec commands, for example I have an nginx container and in my script I run:</p>
  
  <p><code>docker exec -it containerName /etc/init.d/nginx configtest</code></p>
  
  <p>I want to continue script execution only if nginx config test is success, not when fail.</p>
  
  <p>I've tried out to use <code>$?</code>, but it is <code>0</code> even then configtest output is fail (because docker exec is successfully executed, as I understand).</p>