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!


  • error when I make peer in my virtual box
  • How to delete interface docker0
  • <CoreOS, cloud-config> How to 'Wait' until Docker Private Registry is ready?
  • How can I use Hashicorp Vault to manage my application secrets?
  • Failed connections between docker containers
  • GitLab CI runner - can't access other repository
  • sort does not what I want since it also resorts before reverting order.

  • Cron job can't connect to Docker daemon
  • how to set up a fast and light development environment using docker?
  • Where are binaries of a program running inside a Docker container?
  • Paperclip on docker doesn't upload image?
  • How do I read a docker environment variable within a js script?
  • ElasticBeanstalk with Docker: how to use create-environment from aws cli
  • 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.