(以“== Concepts == * Container ID: a long hex string. Usually its prefix is enough. * Image: a template. == Basic usage == === Get software image === docker pull <n...”为内容创建页面) |
(→Run) |
||
(未显示同一用户的8个中间版本) | |||
第2行: | 第2行: | ||
* Container ID: a long hex string. Usually its prefix is enough. | * Container ID: a long hex string. Usually its prefix is enough. | ||
* Image: a template. | * Image: a template. | ||
+ | |||
+ | == Common images == | ||
+ | * ubuntu: Ubuntu distribution | ||
+ | * debian: Debian distribution | ||
+ | * busybox: basic Busybox | ||
+ | * gcc: with GCC | ||
+ | ** gcc:5: gcc version 5 | ||
== Basic usage == | == Basic usage == | ||
=== Get software image === | === Get software image === | ||
− | docker pull <name>:<version> | + | docker pull <name>[:<version>] |
=== Run === | === Run === | ||
− | docker run - | + | docker run -it <image name> |
+ | |||
+ | === Start === | ||
+ | Start a stopped instance | ||
+ | docker start -ai <container ID> | ||
=== Attach === | === Attach === | ||
− | docker attach | + | Attach to a running instance |
+ | docker attach <container ID> | ||
=== Mount external directory === | === Mount external directory === | ||
− | docker run - | + | docker run -it -v <host directory>:<guest directory> <image name> |
== Management == | == Management == | ||
第30行: | 第42行: | ||
=== Create template from current container === | === Create template from current container === | ||
docker commit <container ID> <new image name> | docker commit <container ID> <new image name> | ||
+ | |||
+ | === List images === | ||
+ | docker images |
2016年7月1日 (五) 22:29的最新版本
目录
Concepts
- Container ID: a long hex string. Usually its prefix is enough.
- Image: a template.
Common images
- ubuntu: Ubuntu distribution
- debian: Debian distribution
- busybox: basic Busybox
- gcc: with GCC
- gcc:5: gcc version 5
Basic usage
Get software image
docker pull <name>[:<version>]
Run
docker run -it <image name>
Start
Start a stopped instance
docker start -ai <container ID>
Attach
Attach to a running instance
docker attach <container ID>
Mount external directory
docker run -it -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>
List images
docker images