How To List and Attach to Docker Containers

Reading Time: < 1 minute

 

Preflight Check
  • As of June 2014 Docker has officially released v1.0.0.
  • These instructions are intended for listing and attaching to Docker containers.
  • I’ll be working from a Liquid Web Core Managed CentOS 6.6 server (or CentOS 7, Ubuntu 14.04 LTS, Fedora 20, Fedora 21), and I’ll be logged in as root.
  • I have one Docker container running.

List Containers

First, we’ll list which containers we have running:

docker ps

Your result should look similar to this:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9c09acd48a25 fedora:20 /bin/bash 55 minutes ago Up 53 minutes furious_heisenberg

To list all local containers use -a option:

docker ps -a

It is some times handy to view the latest created container, including non-running containers. Simply use the -l option:

docker ps -l

Attach to a Specific Container

To attach to a specific container you must have the Container ID. In this case, we’ll attach to the container with the ID 9c09acd48a25 :

docker attach 9c09acd48a25

Continue through this series of tutorials to configuring your container, and committing the changes to create a Docker image.

About the Author: J. Mays

Have Some Questions?

Our Sales and Support teams are available 24 hours by phone or e-mail to assist.

1.800.580.4985
1.517.322.0434

Latest Articles

What is Object Storage?

Read Article

What is Formik?

Read Article

Five Steps to Create a Robots.txt File for Your Website

Read Article

Premium Business Email Pricing FAQ

Read Article

Microsoft Exchange Server Security Update

Read Article