mirror of https://github.com/docker/docs.git
commit
fbadf11d20
|
@ -4,8 +4,8 @@ page_keywords: Examples, Usage, basic commands, docker, documentation, examples
|
||||||
|
|
||||||
# First steps with Docker
|
# First steps with Docker
|
||||||
|
|
||||||
This guide assumes you have a working installation of Docker. To check
|
This guide assumes you have a working installation of Docker. To verify Docker is
|
||||||
your Docker install, run the following command:
|
installed, use the following command:
|
||||||
|
|
||||||
# Check that you have a working install
|
# Check that you have a working install
|
||||||
$ docker info
|
$ docker info
|
||||||
|
@ -35,22 +35,23 @@ and download it from [Docker Hub](https://hub.docker.com) to a local
|
||||||
image cache.
|
image cache.
|
||||||
|
|
||||||
> **Note**:
|
> **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
|
> hash `539c0211cd76: Download complete` which is the
|
||||||
> short form of the image ID. These short image IDs are the first 12
|
> 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
|
> 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" }}
|
{{ include "no-remote-sudo.md" }}
|
||||||
|
|
||||||
## Running an interactive shell
|
## Running an interactive shell
|
||||||
|
|
||||||
# Run an interactive shell in the ubuntu image,
|
To run an interactive shell in the Ubuntu image:
|
||||||
# allocate a tty, attach stdin and stdout
|
|
||||||
# To detach the tty without exiting the shell,
|
$ docker run -i -t ubuntu /bin/bash
|
||||||
# use the escape sequence Ctrl-p + Ctrl-q
|
|
||||||
# note: This will continue to exist in a stopped state once exited (see "docker ps -a")
|
The `-i` flag starts an interactive container. The `-t` flag creates a pseudo-TTY that attaches `stdin` and `stdout`.
|
||||||
$ docker run -i -t ubuntu /bin/bash
|
|
||||||
|
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
|
## 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:
|
`-H` accepts host and port assignment in the following format:
|
||||||
|
|
||||||
tcp://[host][:port]` or `unix://path
|
tcp://[host][:port] or unix://path
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@ when no `-H` was passed in.
|
||||||
|
|
||||||
`-H` also accepts short form for TCP bindings:
|
`-H` also accepts short form for TCP bindings:
|
||||||
|
|
||||||
host[:port]` or `:port
|
host[:port] or :port
|
||||||
|
|
||||||
Run Docker in daemon mode:
|
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
|
Save your containers state to an image, so the state can be
|
||||||
re-used.
|
re-used.
|
||||||
|
|
||||||
When you commit your container only the differences between the image
|
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.
|
||||||
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.
|
|
||||||
|
|
||||||
# Commit your container to a new named image
|
# Commit your container to a new named image
|
||||||
$ docker commit <container_id> <some_name>
|
$ docker commit <container> <some_name>
|
||||||
|
|
||||||
# List your images
|
# List your images
|
||||||
$ docker images
|
$ docker images
|
||||||
|
|
Loading…
Reference in New Issue