Docker 概述
本文翻译自docker官网: https://docs.docker.com/get-started/overview/#docker-architecture
Docker is an open platform for developing, shipping, and running applications.
Docker enables you to separate your applications from your infrastructure so
you can deliver software quickly. With Docker, you can manage your infrastructure
in the same ways you manage your applications. By taking advantage of Docker's
methodologies for shipping, testing, and deploying code quickly, you can
significantly reduce the delay between writing code and running it in production.
Docker provides the ability to package and run an application in a loosely isolated
environment called a container. The isolation and security allow you to run many
containers simultaneously on a given host. Containers are lightweight and contain
everything needed to run the application, so you do not need to rely on what is
currently installed on the host. You can easily share containers while you work,
and be sure that everyone you share with gets the same container that works in the
same way.
Docker provides tooling and a platform to manage the lifecycle of your containers:
Fast, consistent delivery of your applications
Docker streamlines the development lifecycle by allowing developers to work in
standardized environments using local containers which provide your applications
and services. Containers are great for continuous integration and continuous
delivery (CI/CD) workflows.
Consider the following example scenario:
Responsive deployment and scaling
Docker's container-based platform allows for highly portable workloads. Docker
containers can run on a developer's local laptop, on physical or virtual
machines in a data center, on cloud providers, or in a mixture of environments.
Docker's portability and lightweight nature also make it easy to dynamically
manage workloads, scaling up or tearing down applications and services as
business needs dictate, in near real time.
Running more workloads on the same hardware
Docker is lightweight and fast. It provides a viable, cost-effective alternative
to hypervisor-based virtual machines, so you can use more of your compute
capacity to achieve your business goals. Docker is perfect for high density
environments and for small and medium deployments where you need to do more with
fewer resources.
Docker uses a client-server architecture. The Docker client talks to the
Docker daemon , which does the heavy lifting of building, running, and
distributing your Docker containers. The Docker client and daemon can
run on the same system, or you can connect a Docker client to a remote Docker
daemon. The Docker client and daemon communicate using a REST API, over UNIX
sockets or a network interface. Another Docker client is Docker Compose,
that lets you work with applications consisting of a set of containers.
[图片上传失败...(image-17b2f-1618407573391)]
The Docker daemon ( dockerd ) listens for Docker API requests and manages Docker
objects such as images, containers, networks, and volumes. A daemon can also
communicate with other daemons to manage Docker services.
The Docker client ( docker ) is the primary way that many Docker users interact
with Docker. When you use commands such as docker run , the client sends these
commands to dockerd , which carries them out. The docker command uses the
Docker API. The Docker client can communicate with more than one daemon.
A Docker registry stores Docker images. Docker Hub is a public
registry that anyone can use, and Docker is configured to look for images on
Docker Hub by default. You can even run your own private registry.
When you use the docker pull or docker run commands, the required images are
pulled from your configured registry. When you use the docker push command,
your image is pushed to your configured registry.
When you use Docker, you are creating and using images, containers, networks,
volumes, plugins, and other objects. This section is a brief overview of some
of those objects.
An image is a read-only template with instructions for creating a Docker
container. Often, an image is based on another image, with some additional
customization. For example, you may build an image which is based on the ubuntu
image, but installs the Apache web server and your application, as well as the
configuration details needed to make your application run.
You might create your own images or you might only use those created by others
and published in a registry. To build your own image, you create a Dockerfile
with a simple syntax for defining the steps needed to create the image and run
it. Each instruction in a Dockerfile creates a layer in the image. When you
change the Dockerfile and rebuild the image, only those layers which have
changed are rebuilt. This is part of what makes images so lightweight, small,
and fast, when compared to other virtualization technologies.
A container is a runnable instance of an image. You can create, start, stop,
move, or delete a container using the Docker API or CLI. You can connect a
container to one or more networks, attach storage to it, or even create a new
image based on its current state.
By default, a container is relatively well isolated from other containers and
its host machine. You can control how isolated a container's network, storage,
or other underlying subsystems are from other containers or from the host
machine.
A container is defined by its image as well as any configuration options you
provide to it when you create or start it. When a container is removed, any changes to
its state that are not stored in persistent storage disappear.
The following command runs an ubuntu container, attaches interactively to your
local command-line session, and runs /bin/bash .
When you run this command, the following happens (assuming you are using
the default registry configuration):
Docker is written in the Go programming language and takes
advantage of several features of the Linux kernel to deliver its functionality.
Docker uses a technology called namespaces to provide the isolated workspace
called the container . When you run a container, Docker creates a set of
namespaces for that container.
These namespaces provide a layer of isolation. Each aspect of a container runs
in a separate namespace and its access is limited to that namespace.
蓬供复方: Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机制,相互之间不会有任何接口(类似 iPhone 的 app).几乎没有性能开销,可以很容易地在机器和数据中心中运行.最重要的是,他们不依赖于任何语言、框架或包括系统.[1]
阿图什市19653797729: docker究竟是什么,为什么这么流行,它的优点和缺陷有哪些 - ?
蓬供复方: 简单得来说,Docker是一个由GO语言写的程序运行的“容器”(Linux containers, LXCs); 目前云服务的基石是操作系统级别的隔离,在同一台物理服务器上虚拟出多个主机.Docker则实现了一种应用程序级别的隔离; 它改变我们基本的开发、...
阿图什市19653797729: 谁可以简单介绍一下docker到底是干什么用的? - ?
蓬供复方: 参考sf上好雨科技的回答: docker主要有2大核心贡献和对于软件交付的影响: 2大贡献: 1、封装,将运行环境与代码封装到一个盒子中 2、镜像仓库,将镜像以类似代码仓库的方式分发软件交付的影响:作为一个IT界“集装箱” 它把整个软件交付的流程和方式都改变了,就相当于 集装箱 一样改变了整个航运、空运、陆运的方式,让生产者产出的产品到最终用户完全一致,无论中途经过多少过程.有了这个核心的“集装箱” 整个生态都围着它打转.
阿图什市19653797729: 什么是docker容器技术? - ?
蓬供复方: docker容器技术指Docker是一个由GO语言写的程序运行的“容器”(Linux containers, LXCs) Docker则实现了一种应用程序级别的隔离,它改变我们基本的开发、操作单元,由直接操作虚拟主机(VM),转换到操作程序运行的“容器”上来....
阿图什市19653797729: Docker的主要作用是什么? - ?
蓬供复方: 目前来看,Docker至少有以下应用场景:1)测试:Docker 很适合用于测试发布,将 Docker 封装后可以直接提供给测试人员进行运行,不再需要测试人员与运维、开发进行配合,进行环境搭建与部署.2)测试数据分离:在测试中,经常由...
阿图什市19653797729: docker到底是什么??
蓬供复方: docker官网上介绍是“Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications..”看完这句话,估计你可能还没明白究竟是啥.长话短说,可以把它想象成一个用了一种新颖方式实现的超轻量虚拟机.当然在实现的原理和应用上还是和VM有巨大差别的,并且专业的叫法是应用容器(Application Container).听朋友说,dnsdun有新推出基于dockerntent
阿图什市19653797729: linux里面的docker到底是什么? - ?
蓬供复方: 一个利用LXC建立起来的一个容器,用于封装作业程序,运行库和其他相关的文件,以便可以方便地部署或者开发(不需要再次配置运行环境). 大部分情况下这些container可以像游戏机的卡带/DVD一样插入系统,直接运行 :) 同时这个软件的开发者也叫同样的名字 Docker.
阿图什市19653797729: 群晖docker 可以做什么 - ?
蓬供复方: 1、docker就是VMware,docker里面的镜像就相当于VMware在装系统时使用的镜像文件. 2、docker里面创建的容器就是在VMware里面创建的虚拟机并已使用镜像文件装好系统. 3、虚拟机能做什么就能做什么,就是一台服务器虚拟化很多服...
阿图什市19653797729: 怎么用通俗易懂的话来解释Docker(容器)技术 - ?
蓬供复方: 官网的介绍是这样的: Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications.... 其实看完这句话还是不明白究竟是啥的,下面就慢慢解释.不过长话短说的话,把他想象成一个用了一种新颖方式...