標籤 : dockerhtml
[TOC]linux
本文對docker進行大體介紹,包括概述,安裝,簡單使用,架構,基本原理等方面git
能夠參考下面三篇文章。從我使用的感覺來看,我以爲Docker就是一個應用打包工具,把寫好的應用用docker打包發佈,而後別人就能夠直接部署使用了,特別方便。github
Docker Engine is a client-server application with these major components:docker
我以爲官網的解釋很言簡意賅,附上圖(摘自官網)shell
安裝參考Install Docker Engineubuntu
以ubuntu 14.04 爲例,參考Installation on Ubuntu安裝Docker engine架構
這裏列出重要的步驟:app
注 :若是輸入docker info
出問題,多半是權限問題,以sudo運行試試dom
Mac下安裝參考Installation on Mac OS X
Mac下有兩種安裝方式供選
二者的區別請參考 Docker for Mac vs. Docker Toolbox
先很少說,跑起來體驗下。具體的步驟和指令在Docker簡明教程這篇文章已經寫得很清楚了,在此再也不贅述
由上圖可知,docker是一個client-server架構
docker的內部主要有三種資源/組件
這裏重點說說images and containers
Docker使用union file systems 把不一樣的層(layer)作整合成單一的image. Union File System的中一種是AUFS,能夠參考這篇博文
官網文檔對image的layers是這麼描述的
Each Docker image references a list of read-only layers that represent filesystem differences. Layers are stacked on top of each other to form a base for a container’s root filesystem
新版docker(version>=1.10)的存儲模型有變化
Previously, image and layer data was referenced and stored using a randomly generated UUID. In the new model this is replaced by a secure content hash.
而container和image的主要區別就在於top writable layer,全部對image的更改都保存在這一層。換句話說,多個container能夠共享同一個image,這就大大節省了空間。實現image和container的管理有兩個關鍵的技術:stackable image layers 和 copy-on-write (CoW).
從圖中能夠看出,copy-on-write (CoW)是一個很好的策略,既節省了空間,又避免了因數據共享帶來的寫衝突問題,從而提升效率。
本文主要對docker作簡單介紹,對於一些更詳細的知識,如docker file,volume,network,docker compose等等,會另寫文章進行介紹。至於很具體的操做指令,好比怎麼安裝,怎麼build image和run container來跑一個簡單的docker hello world,請參考官方文檔Docker Engine部分的「get started with docker」或者"learn by example",也可參考文末的一些參考資料
- Docker Documentation(官方文檔)
- Docker入門教程(系列)
- Docker簡明教程(使用演示)
- docker中文(系列)
- docker資源
- docker-從入門到實踐(gitbook)