(以“== Concepts == * Container ID: a long hex string. Usually its prefix is enough. * Image: a template. == Basic usage == === Get software image === docker pull <n...”为内容创建页面)
 
第5行: 第5行:
 
== Basic usage ==
 
== Basic usage ==
 
=== Get software image ===
 
=== Get software image ===
     docker pull <name>:<version>
+
     docker pull <name>[:<version>]
  
 
=== Run ===
 
=== Run ===

2016年6月29日 (三) 21:43的版本

Concepts

  • Container ID: a long hex string. Usually its prefix is enough.
  • Image: a template.

Basic usage

Get software image

   docker pull <name>[:<version>]

Run

   docker run -t -i <image name>

Attach

   docker attach -a -i <container ID>

Mount external directory

   docker run -t -i -v <host directory>:<guest directory> <image name>

Management

List containers

   docker ps -a

Only the running ones:

   docker ps

Remove container

   docker rm <container ID>

Get history console output

   docker logs <container ID>

Create template from current container

   docker commit <container ID> <new image name>