title: Get the last Docker image built
body: <p>This command gives a list of image and container IDs ordered from top to bottom by last build time:</p>
  
  <pre><code>docker images
  </code></pre>
  
  <p>All my docker images are appended with the hash git head commit.</p>
  
  <p>The results</p>
  
  <pre><code>REPOSITORY                                 TAG                 IMAGE ID            CREATED             SIZE
  username/play-table-of-contents-1474f94    latest              6141b8177c2f        34 minutes ago      149MB
  username/play-table-of-contents-2616f5f    latest              2b5422dd91ba        About an hour ago   149MB
  </code></pre>
  
  <p>Is there a way to get only the last image by name ? ( ie: case 6141b8177c2f )</p>
  
  <p>I tried with </p>
  
  <pre><code>docker images --format "{{.Names}}"
  </code></pre>
  
  <p>My end goal is to run the last docker image built. To do this, I need to </p>
  
  <ol>
  <li>get the last image name in bash script variable. </li>
  <li><code>docker run ... $last_image ...</code></li>
  </ol>