Docker: the Linux container engine
原文地址:https://github.com/dotcloud/docker/ Docker教程中文版本:http://www.widuu.com/docker/
Docker is an open source project to pack, ship and run any application as a lightweight container Docker containers are both hardware-agnostic and platform-agnostic. This means that they can run anywhere, from your laptop to the largest EC2 compute instance and everything in between - and they dont require that you use a particular language, framework or packaging system. That makes them great building blocks for deploying and scaling web apps, databases and backend services without depending on a particular stack or provider. Docker is an open-source implementation of the deployment engine which powers dotCloud, a popular Platform-as-a-Service. It benefits directly from the experience accumulated over several years of large-scale operation and support of hundreds of thousands of applications and databases. Better than VMs A common method for distributing applications and sandboxing their execution is to use virtual machines, or VMs. Typical VM formats are VMWares vmdk, Oracle Virtualboxs vdi, and Amazon EC2s ami. In theory these formats should allow every developer to automatically package their application into a "machine" for easy distribution and deployment. In practice, that almost never happens, for a few reasons:
Performance: running VMs consumes significant CPU and memory, which makes them impractical in many scenarios, for example local development of multi-tier applications, and large-scale deployment of cpu and memory-intensive applications on large numbers of machines. Portability: competing VM environments dont play well with each other. Although conversion tools do exist, they are limited and add even more overhead. Hardware-centric: VMs were designed with machine operators in mind, not software developers. As a result, they offer very limited tooling for what developers need most: building, testing and running their software. For example, VMs offer no facilities for application versioning, monitoring, configuration, logging or service discovery. By contrast, Docker relies on a different sandboxing method known as containerization. Unlike traditional virtualization, containerization takes place at the kernel level. Most modern operating system kernels now support the primitives necessary for containerization, including Linux with openvz, vserver and more recently lxc, Solaris with zones and FreeBSD with Jails. Docker builds on top of these low-level primitives to offer developers a portable format and runtime environment that solves all 4 problems. Docker containers are small (and their transfer can be optimized with layers), they have basically zero memory and cpu overhead, they are completely portable and are designed from the ground up with an application-centric design. The best part: because Docker operates at the OS level, it can still be run inside a VM! Plays well with others Docker does not require that you buy into a particular programming language, framework, packaging system or configuration language. Is your application a Unix process? Does it use files, tcp connections, environment variables, standard Unix streams and command-line arguments as inputs and outputs? Then Docker can run it. Can your applications build be expressed as a sequence of such commands? Then Docker can build it. Escape dependency hell A common problem for developers is the difficulty of managing all their applications dependencies in a simple and automated way. This is usually difficult for several reasons:
Cross-platform dependencies. Modern applications often depend on a combination of system libraries and binaries, language-specific packages, framework-specific modules, internal components developed for another project, etc. These dependencies live in different "worlds" and require different tools - these tools typically dont work well with each other, requiring awkward custom integrations.
Conflicting dependencies. Different applications may depend on different versions of the same dependency. Packaging tools handle these situations with various degrees of ease - but they all handle them in different and incompatible ways, which again forces the developer to do extra work.
Custom dependencies. A developer may need to prepare a custom version of their applications dependency. Some packaging systems can handle custom versions of a dependency, others cant - and all of them handle it differently.
Docker solves dependency hell by giving the developer a simple way to express all their applications dependencies in one place, and streamline the process of assembling them. If this makes you think of XKCD 927, dont worry. Docker doesnt replace your favorite packaging systems. It simply orchestrates their use in a simple and repeatable way. How does it do that? With layers. Docker defines a build as running a sequence of Unix commands, one after the other, in the same container. Build commands modify the contents of the container (usually by installing new files on the filesystem), the next command modifies it some more, etc. Since each build command inherits the result of the previous commands, the order in which the commands are executed expresses dependencies. Heres a typical Docker build process:
FROM ubuntu:12.04 RUN apt-get update RUN apt-get install -q -y python python-pip curl RUN curl -L https://github.com/shykes/helloflask/archive/master.tar.gz | tar -xzv RUN cd helloflask-master pip install -r requirements.txtNote that Docker doesnt care how dependencies are built - as long as they can be built by running a Unix command in a container. Getting started Docker can be installed on your local machine as well as servers - both bare metal and virtualized. It is available as a binary on most modern Linux systems, or as a VM on Windows, Mac and other systems. We also offer an interactive tutorial for quickly learning the basics of using Docker. For up-to-date install instructions and online tutorials, see the Getting Started page. Usage examples Docker can be used to run short-lived commands, long-running daemons (app servers, databases etc.), interactive shell sessions, etc. You can find a list of real-world examples in the documentation. Under the hood Under the hood, Docker is built on the following components: The cgroup and namespacing capabilities of the Linux kernel; The Go programming language.
Contributing to Docker Want to hack on Docker? Awesome! There are instructions to get you started here. They are probably not perfect, please let us know if anything feels wrong or incomplete. Legal Brought to you courtesy of our legal counsel. For more context, please see the Notice document. Use and transfer of Docker may be subject to certain restrictions by the United States and other governments.
It is your responsibility to ensure that your use and/or transfer does not violate applicable laws. For more information, please see http://www.bis.doc.gov Licensing Docker is licensed under the Apache License, Version 2.0. See LICENSE for full license text.
Docker 镜像(image)& 容器(container) 什么是 Docker 镜像(image)? 镜像由多个层组成,每层叠加之后,从外部看来就如一个独立的对象; 镜像内部是一个精简的操作系统(OS),同时还包含应用运行所必须的文件和依赖包; 镜像可以运行一个或多个容器,同时镜像也可以停止某个容器的运行,并从中创建新的镜像;【镜像(iamge)的分类】...
Docker系列开篇之Virtual Machine VS Container(一) Docker系列开篇之Virtual Machine VS Container(一)前言本节开始我们正式进入Docker系列,网上关于Docker相关文章如数家珍,写博客至今,我也一直在朝着如何写出通俗易懂且不枯燥的文章这个目标前进,喃喃自语的同时也希望看到文章的童鞋能明白我在讲什么,将知识点叙述清楚没有,讲解的效果如何,是否有启发或收获,能够得到及时的反馈当然也能让我理解的更透彻,好了,我们开始吧。
连接 Docker Container 的几种方式 经过熟悉之后,在 docker 里安装了一个 ubuntu 准备学习使用。然后遇到了一些问题:使用 docker run -d ubuntu 之后,container在运行之后马上退出了。 原因很简单,在docker run 之后没有命令参数,添加 bash 就可以了: docker run -.
相关文章
- Linux命令集
- [Linux] ubuntu各目录含义
- linux 2.6.36+s3c6410 SPI子系统接口讨论 --添加spi设备节点
- 关于Linux vi命令 vi命令一览表
- java 11 完全支持Linux容器(包括Docker)
- 查看Linux、Tomcat、JAVA版本信息
- linux 下的wc命令
- linux(centos8):安装prometheus服务端/node_exporter客户端(prometheus 2.18.1)
- linux(centos8):用fallocate快速生成大文件
- Docker 基础技术之 Linux namespace 详解
- Linux基础之linux常用命令之文本替换
- Linux Shell脚本自动化编程实战- shell并发
- 快速清空linux下文本文件内容
- 【Linux 内核】进程优先级与调度策略 ① ( SCHED_FIFO 调度策略 | SCHED_RR 调度策略 | 进程优先级 )
- linux 文件名称前后缀操作函数----取目录函数dir、取文件名称函数notdir、取后缀函数suffix、取前缀basename、加后缀函数addsuffix、加前缀addprefix、连接函数join
- RTX30系列linux+docker容器的GPU配置(tensorflow-gpu==1.15~2.x、tensorrt 7、cuda、cudnn)附加resnet50模型测试
- 使用docker搭建linux dash 轻量级监控工具
- Linux系统的grub.cfg文件损坏修复
- Linux动态库搜索路径优先级;Linux运⾏时动态库搜索路径优先级
- docker cobbler批量部署Linux/windows系统(三)——筑梦之路
- docker cobbler批量部署Linux/windows系统(二)——筑梦之路
- linux find 命令详解
- Linux之uevent与ueventd区别
- Docker编译linux kernel
- mac docker 安装 kali linux
- Linux centos7 docker部署gitlab私有服务器
- Linux 比较奇怪的docker启动报错,原因暂时不清楚
- Linux之centos7环境下扩展SWAP分区
- Linux tips: shell中启动多进程并行批处理的技巧
- Docker 深入剖析 Linux 容器
- Linux下用户空间访问I/O端口的相关函数
- wsl vscode Linux安装docker