How To List and Attach to Docker Containers

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 <reference_page_text>Container ID. In this case, we’ll attach to the container with the ID 9c09acd48a25 :

docker attach 9c09acd48a25

 

  • 301 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

How to List Compiled PHP Modules from Command Line

Pre-Flight Check These instructions are intended specifically for listing compiled PHP modules...

How to Install or Uninstall PECL Extensions

Pre-Flight Check These instructions are intended specifically for installing or uninstalling...

How to Install the MongoDB PHP Driver (Extension) on CentOS 6

Step 1: Setup Environment, Install PHP Extension & Application Repository (PEAR) As a matter...

How to Add a User and Grant Root Privileges on CentOS 6.5

Step 1: Add the User It’s just one simple command to add a user. In this case, we’re...

How to Add a User and Grant Root Privileges on Ubuntu 14.04

Step 1: Add the User It’s just one simple command to add a user. In this case, we’re...