How to show the ID of the oldest running docker container?

I using docker Docker version 1.3.2, build 50b8feb. There are some new filters for the ps command, but it seems nothing provide what I need. I just want to see the oldest container running, to kill it, wait and kill the next oldest one. I hope somebody can come around with some bash magic I am not able to see at the moment. Thanks!


  • How to convert docker-compose setup to docker image?
  • [kubeadm]error updating cni config
  • Jmeter and Docker
  • boot2docker workflow for building an image
  • Verfiy the version of ubuntu running in a Docker container
  • Docker: filesystem changes not exporting
  • sort does not what I want since it also resorts before reverting order.

  • Rethinkdb race conditions creating table
  • Fabric Composer quick-start failing when trying to deploy the bna file on OSX
  • What are the typical uses cases for LXC versus VM?
  • Memory and CPU usage definition in docker cadvisor
  • Unable to use the “Docker push” command with ECR
  • Obtain ID of just-built image
  • One Solution collect form web for “How to show the ID of the oldest running docker container?”

    Oh yeah, captain obvious. I just needed to use tail.

    docker ps -aq | tail -n 1
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.