什么是Docker

Docker is an open-source project for automating the deployment of applications as portable, self-sufficient containers that can run on the cloud or on-premises. Docker is also a company that promotes and evolves this technology, working in collaboration with cloud, Linux, and Windows vendors, including Microsoft.

Figure 2-2. Docker deploys containers at all layers of the hybrid cloud

Docker image containers can run natively on Linux and Windows. However, Windows images can run only on Windows hosts and Linux images can run only on Linux hosts, meaning host a server or a VM.

Developers can use development environments on Windows, Linux, or macOS. On the development computer, the developer runs a Docker host where Docker images are deployed, including the app and its dependencies. Developers who work on Linux or on the Mac use a Docker host that is Linux based, and they can create images only for Linux containers. (Developers working on the Mac can edit code or run the Docker CLI from macOS, but as of the time of this writing, containers do not run directly on macOS.) Developers who work on Windows can create images for either Linux or Windows Containers.

To host containers in development environments and provide additional developer tools, Docker ships Docker Community Edition (CE) for Windows or for macOS. These products install the necessary VM (the Docker host) to host the containers. Docker also makes available Docker Enterprise Edition (EE), which is designed for enterprise development and is used by IT teams who build, ship, and run large business-critical applications in production.

To run Windows Containers, there are two types of runtimes:

  • Windows Server Containers provide application isolation through process and namespace isolation technology. A Windows Server Container shares a kernel with the container host and with all containers running on the host.
  • Hyper-V Containers expand on the isolation provided by Windows Server Containers by running each container in a highly optimized virtual machine. In this configuration, the kernel of the container host is not shared with the Hyper-V Containers, providing better isolation.

The images for these containers are created the same way and function the same. The difference is in how the container is created from the image—running a Hyper-V Container requires an extra parameter. For details, see Hyper-V Containers.

Comparing Docker containers with virtual machines

Figure 2-3 shows a comparison between VMs and Docker containers.



Virtual Machines Docker Containers

Virtual machines include the application, the required libraries or binaries, and a full guest operating system. Full virtualization requires more resources than containerization. Containers include the application and all its dependencies. However, they share the OS kernel with other containers, running as isolated processes in user space on the host operating system. (Except in Hyper-V containers, where each container runs inside of a special virtual machine per container.)



Figure 2-3. Comparison of traditional virtual machines to Docker containers

Because containers require far fewer resources (for example, they do not need a full OS), they are easy to deploy and they start fast. This allows you to have higher density, meaning that it allows you to run more services on the same hardware unit, thereby reducing costs.

As a side effect of running on the same kernel, you get less isolation than VMs.

The main goal of an image is that it makes the environment (dependencies) the same across different deployments. This means that you can debug it on your machine and then deploy it to another machine with the same environment guaranteed.

A container image is a way to package an app or service and deploy it in a reliable and reproducible way. You could say that Docker is not only a technology, but also a philosophy and a process.

When using Docker, you will not hear developers say, “It works on my machine, why not in production?” They can simply say, “It runs on Docker,” because the packaged Docker application can be executed on any supported Docker environment, and it will run the way it was intended to on all deployment targets (Dev, QA, staging, production, etc.).+

PREVIOUS NEXT

时间: 2024-10-20 19:41:53

什么是Docker的相关文章

Docker学习笔记——Mongo Dockerfile及容器运行

1.创建项目目录mongo,在目录下上传下载的Mongodb安装文件及mongo.conf配置文件,创建Dockerfile文件,项目结构如下: mongo - Dockerfile - mongo.conf - mongodb-linux-x86_64-3.4.9.tgz - data - logs Dockerfile内容如下: # mongo # SOURCE_IMAGE FROM centos # MAINTAINER_INFO MAINTAINER bluemooder [email 

docker深入2-API示例

2017/9/18 一.目的 演示 http API 使用的方式 注1:本次实例是在 docker swarm mode 下使用的,目的是:更新指定服务的镜像. 注2:要在 swarm manager node 上执行. docker 的 API 文档是自动生成的,没有太多有用的示例可用. [版本] ~]# docker version Client:  Version:      17.06.0-ce  API version:  1.30  Go version:   go1.8.3  Gi

docker私有仓库删除image

docker仓库存放着公司内部的镜像.时间长了难免存在一些废弃的镜像在里面.如果不删除造成空间的浪费.下面就简单的看看仓库中的镜像是怎么删除的. 第一步:registry启动依赖config.yml配置文件:在默认文件的storage区域中添加delete_enable_ture配置项.也可以在启动时候指定-e添加.允许删除镜像: 配置文件: 第二步:下载registry镜像并启动容器. docker run  -d -v /conf/:/etc/docker/registry -v /opt/

docker run常用命令及 解决 ubuntu镜像无法识别 ifconfig ping 命令

docker run -it     docker 前端启动 container容器           -d             后端启动 container容器           -p             固定端口映射            -P             不固定端口映射           --name         给生成的容器起名字docker ps:默认显示正在运行的container       ps -a 显示所有的container容器docker r

原创:Docker在云家政的应用 谢绝复制粘贴内容

我们公司目前大规模使用了Docker,目前除了数据库应用,其他所有应用都在Docker容器内运行,下面我就Docker在公司的应用做一些分享.. 首先我介绍一下公司的背景,公司属于中小型创业公司,服务器数量不多,但是为了解决一些问题,我们引入了现在比较火的Docker技术. 看一下我们在没用Docker之前遇到的问题: 1.线上环境和测试环境不完全一致,导致测试好的功能上线后会出现一些BUG. 2.部署新项目步骤繁琐,批量部署运行环境后,需要根据每个项目不同的情况,手动修改配置参数. 3.新项目

win7 系统安装 docker

如果顺利的话,步骤如下: 1.下载DockerToolbox 2.安装DockerToolbox,默认配置,一路下一步即可完成安装 3.安装成功后,桌面会新增三个快捷方式,如下图 4.点击运行Docker Quickstart Terminal,会从github加载boot2docker.iso,加载完成后会自动在Oracle VM VirtualBox中创建一个Linux的虚拟环境 5.显示如下图表示安装成功 6.执行 docker run hello-world再次验证一下 如果遇到问题,可

【Docker常见问题1】​下载docker镜像,如何下载指定的应用版本?

举例:如何下载postgres版本9.2? 步骤1:访问官网 https://hub.docker.com/ 步骤2:搜索postgres镜像 搜索框,输入postgres进行搜索 步骤3:查看已发布的版本 点击进入postgres页面,并点击tags,可看到已发布的版本 步骤4:选择一个版本下载 下载版本9.2 sudo docker pull postgres:9.2 或下载最新版本 sudo docker pull postgres:latest

【Docker常见问题2】如何设置容器日志大小和保留个数

举例:当tomcat容器的运行,容器占用空间越来越大,约1个月就会超过2G,如何解决? 步骤1:查看容器日志大小:假设容器目录为/var/lib/docker/containers,那么执行如下命令 cd /var/lib/docker/containers  #进入默认容器空间目录 du -sh *            #统计文件大小2.4G  de92a5643f7ffb106f8abba21fc0f93996842917a52879153adc95a73312934a-json.log

Docker的概念及剖析原理和特点

一.docker的简介: 应用容器是个啥样子呢,一个做好的应用容器长的就像一个装好了一组特定应用的虚拟机一样,比如我现在想用mysql数据库,我直接找个装好了的MySQL的容器就可以了,想用的时候一运行容器,MySQL服务就起来了,就可以使用MySQL了 为什么不能直接安装一个MySQL?或者是SqlServer呢也可以啊? 答:因为有的时候根据每个人的电脑的不同,在物理机安装的时候会出现各种各样的错误,突然你的机器中病毒了或者是挂了,你所有的服务都需要重新安装. 注意:    但是有了dock

docker的存储结构,和以前有了很大不同

在网上学习这一块知识点时,有一个URL讲得很详细, docker 镜像与容器存储目录结构精讲 http://blog.csdn.net/wanglei_storage/article/details/50299491 但我在最新版的docker作验证时,发现早已物是人非,等以后用得着时,再仔细研究吧. 我作的截图如下: overlay里作image相关的存储, 而container目录里作run起来的docker容器的相关存储, 且两者之间,有uuid作对应. 在下图中已标明.