Signed-off-by: He Simei <hesimei@zju.edu.cn>
This commit is contained in:
He Simei 2015-06-01 19:18:13 +08:00
Родитель 4caa9392f8
Коммит 0d72772c37
1 изменённых файлов: 15 добавлений и 17 удалений

Просмотреть файл

@ -4,8 +4,8 @@ page_keywords: Examples, Usage, basic commands, docker, documentation, examples
# First steps with Docker
This guide assumes you have a working installation of Docker. To check
your Docker install, run the following command:
This guide assumes you have a working installation of Docker. To verify Docker is
installed, use the following command:
# Check that you have a working install
$ docker info
@ -35,22 +35,23 @@ and download it from [Docker Hub](https://hub.docker.com) to a local
image cache.
> **Note**:
> When the image has successfully downloaded, you will see a 12 character
> When the image is successfully downloaded, you see a 12 character
> hash `539c0211cd76: Download complete` which is the
> short form of the image ID. These short image IDs are the first 12
> characters of the full image ID - which can be found using
> `docker inspect` or `docker images --no-trunc=true`
> `docker inspect` or `docker images --no-trunc=true`.
{{ include "no-remote-sudo.md" }}
## Running an interactive shell
# Run an interactive shell in the ubuntu image,
# allocate a tty, attach stdin and stdout
# To detach the tty without exiting the shell,
# use the escape sequence Ctrl-p + Ctrl-q
# note: This will continue to exist in a stopped state once exited (see "docker ps -a")
$ docker run -i -t ubuntu /bin/bash
To run an interactive shell in the Ubuntu image:
$ docker run -i -t ubuntu /bin/bash
The `-i` flag starts an interactive container. The `-t` flag creates a pseudo-TTY that attaches `stdin` and `stdout`.
To detach the `tty` without exiting the shell, use the escape sequence `Ctrl-p` + `Ctrl-q`. The container will continue to exist in a stopped state once exited. To list all containers, stopped and running use the `docker ps -a` command.
## Bind Docker to another host/port or a Unix socket
@ -74,7 +75,7 @@ Similarly, the Docker client can use `-H` to connect to a custom port.
`-H` accepts host and port assignment in the following format:
tcp://[host][:port]` or `unix://path
tcp://[host][:port] or unix://path
For example:
@ -88,7 +89,7 @@ when no `-H` was passed in.
`-H` also accepts short form for TCP bindings:
host[:port]` or `:port
host[:port] or :port
Run Docker in daemon mode:
@ -164,13 +165,10 @@ TCP and a Unix socket
Save your containers state to an image, so the state can be
re-used.
When you commit your container only the differences between the image
the container was created from and the current state of the container
will be stored (as a diff). See which images you already have using the
`docker images` command.
When you commit your container, Docker only stores the diff (difference) between the source image and the current state of the container's image. To list images you already have, use the `docker images` command.
# Commit your container to a new named image
$ docker commit <container_id> <some_name>
$ docker commit <container> <some_name>
# List your images
$ docker images