save

  1. Usage: docker save [OPTIONS] IMAGE [IMAGE...]
  2. Save an image(s) to a tar archive (streamed to STDOUT bydefault)
  3. -o,--output=""Write to a file, instead of STDOUT

Produces a tarred repository to the standard output stream. Contains all parent layers, and all tags + versions, or specified repo:tag, for each argument provided.

It is used to create a backup that can then be used with docker load

  1. $ sudo docker save busybox > busybox.tar
  2. $ ls -sh busybox.tar
  3. 2.7M busybox.tar
  4. $ sudo docker save --output busybox.tar busybox
  5. $ ls -sh busybox.tar2.7M
  6. busybox.tar
  7. $ sudo docker save -o fedora-all.tar fedora
  8. $ sudo docker save -o fedora-latest.tar fedora:latest

It is even useful to cherry-pick particular tags of an image repository

  1. $ sudo docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy

search

搜索 Docker Hub 中的镜像。

  1. Usage: docker search [OPTIONS] TERM
  2. Search the DockerHubfor images
  3. --automated=false Only show automated builds
  4. --no-trunc=false Don't truncate output
  5. -s, --stars=0 Only displays with at least x stars

查看 Find Public Images on Docker Hub 了解更多信息关于共享镜像的方法。

说明:搜索结果仅仅返回头25个结果。

start

  1. Usage: docker start [OPTIONS] CONTAINER [CONTAINER...]
  2. Restart a stopped container
  3. -a,--attach=false Attach container's STDOUT and STDERR and forward all signals to the process
  4. -i, --interactive=false Attach container's STDIN

当运行在一个容器,这个容器已经被启动了,没有采取任何措施和成功无条件。

stop

  1. Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
  2. Stop a running container by sending SIGTERM andthen SIGKILL after a grace period
  3. -t,--time=10 Number of seconds to wait for the container to stop before killing it.Defaultis10 seconds.

容器中的主进程接受SIGTERM,在宽限期后,接受SIGKILL。

tag

  1. Usage: docker tag [OPTIONS] IMAGE[:TAG][REGISTRYHOST/][USERNAME/]NAME[:TAG]
  2. Tag an image into a repository
  3. -f,--force=falseForce

你可以管理你的镜像,使用名称和标志,然后上传他们到 Share Images via Repositories。

top

  1. Usage: docker top CONTAINER [ps OPTIONS]
  2. Display the running processes of a container

unpause

  1. Usage: docker unpause CONTAINER
  2. Unpause all processes within a container

The docker unpause command uses the cgroups freezer to un-suspend all processes in a container.

See the cgroups freezer documentation for further details.

version

  1. Usage: docker version
  2. Show the Docker version information.

显示 Docker version, API version, Git commit, 和 Go version ( Docker client 和daemon两者的Go version).

  1. $ sudo docker version
  2. Client version: 1.5.0
  3. Client API version: 1.17
  4. Go version (client): go1.4.1
  5. Git commit (client): a8a31ef
  6. OS/Arch (client): darwin/amd64
  7. Server version: 1.5.0
  8. Server API version: 1.17
  9. Go version (server): go1.4.1
  10. Git commit (server): a8a31ef
  11. OS/Arch (server): linux/amd64

wait

  1. Usage: docker wait CONTAINER [CONTAINER...]
  2. Blockuntil a container stops,thenprint its exit code.