Welcome! We’re excited that you want to learn Docker.
This guide contains step-by-step instructions on how to get started with Docker. This guide shows you how to:
- Build and run an image as a container.
- Share images using Docker Hub.
- Deploy Docker applications using multiple containers with a database.
- Run applications using Docker Compose.
What is a container?
A container is a sandboxed process running on a host machine that is isolated from all other processes running on that host machine. That isolation leverages kernel namespaces and cgroups, features that have been in Linux for a long time. Docker makes these capabilities approachable and easy to use. To summarize, a container:
- Is a runnable instance of an image. You can create, start, stop, move, or delete a container using the DockerAPI or CLI.
- Can be run on local machines, virtual machines, or deployed to the cloud.
- Is portable (and can be run on any OS).
- Is isolated from other containers and runs its own software, binaries, configurations, etc.
What is a container image?
A running container uses an isolated filesystem. This isolated filesystem is provided by a container image, and the container image must contain everything needed to run an application – all dependencies, configurations, scripts, binaries, etc. The image also contains other configurations for the container, such as environment variables, a default command to run, and other metadata.
This guide covers topics such as image layers, best practices, and more.
Note
If you’re familiar with
chroot
, then think of a container as an extended version ofchroot
. The filesystem comes from the image. However, a container adds additional isolation not available when using chroot.
Next steps
In this section, we introduced containers and container images.
Next, we containerize a simple application.
原文链接:https://docs.docker.com/get-started/