title: Get exit code from docker entrypoint command
body: <p>I have a docker container that runs a script via the entrypoint directive. The container closes after the entrypoint script is finished. I need to get the exit code from the script in order to do some logging if the script fails. Right now I'm thinking of something like this</p>
  
  <pre><code>docker run container/myContainer:latest
  
  if [ $? != 0 ];
  then
      do some stuff
  fi
  </code></pre>
  
  <p>Is this proper way to achieve this? Specifically, will this be the exit code of docker run or of my entrypoint script?</p>