Overview
本文讲涉及以下内容
- build and run an image as a container
- share iamges using Docker Hub
- Deploy docker applications using multiple contianers with a database
- run applications using Docker Compose
什么是container
Simply put, a container is a sandboxed process on your machine that is isolated from all processes on the host machine. That isolation leverages kernel namespaces and cgroups, features that have bean in Linux for a long time. Docker has worked to make 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 conatiner using the Docker API or CLI.
- can be run on local machines, virtual machines, or deployed to he cloud.
- is portable(can be run on any OS)
- is isolated from other containers and runs its own software, binaries, and configurations.
什么是container image
When running a container, it uses an isolated filesystem. This custom filesystem is proviede by a container image. Since the image contains the container’s filesystem, it must contain everything needed to run an application – all dependencies, configurations, scripts, binaries, etc. The image also contains other configuration for the container, such as environment variables, a default command to run, and other metadata.
If you’r familiar with
chroot
, think of a container as an extended version ofchroot
. The filesystem is simply coming from the image. But a container add addtitional isolation not available when simply using chroot.
发表回复