Docker

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(指南)
 
(未显示1个用户的43个中间版本)
第7行: 第7行:
 
[[OpenStack]]也在其最新发行版(代号Havana)中引入了Docker。
 
[[OpenStack]]也在其最新发行版(代号Havana)中引入了Docker。
 
[[文件:Docker-logo.png|right]]
 
[[文件:Docker-logo.png|right]]
 +
==原理==
 +
Docker 是封装自 [[LXC]] 和 [[cgroup]] 的虚拟化技术。
 +
 +
Docker的overlay存储驱动建立在OverlayFS文件系统之上,它允许将一个文件系统与另一个文件系统重叠(overlay),在上层的文件系统中记录更改,而下层的文件系统保持不变,OverlayFS从Linux 3.18版本以后已进入内核主线。
 +
 
==指南==
 
==指南==
 +
下载Docker,如[https://docs.docker.com/docker-for-mac/install/ macOS] 或
 +
 
Docker Toolbox包含:
 
Docker Toolbox包含:
 
* Docker Client
 
* Docker Client
第20行: 第27行:
 
  $ docker-compose version
 
  $ docker-compose version
 
  $ docker run debian /bin/echo hello world
 
  $ docker run debian /bin/echo hello world
 +
 +
一些配置参考:cat /etc/docker/daemon.json
 +
{
 +
  "registry-mirrors": ["https://registry.docker-cn.com"],
 +
  "insecure-registries": ["172.30.2.245:5000"],
 +
  "exec-opts": ["native.cgroupdriver=systemd"]
 +
}
 +
进入一个正在运行容器,如:
 +
docker exec -t -i <id/container_name>  /bin/bash
 +
 +
清理所有Docker容器、容器卷和镜像 [https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes How To Remove Docker Images, Containers, and Volumes]
 +
docker rm -f $(docker ps -qa)
 +
docker volume rm $(docker volume ls -q)
 +
docker rmi -f $(docker images -q)
 +
清除所有未使用或悬挂(Unused or Dangling)的镜像、容器、卷和网络
 +
docker container prune
 +
docker system prune
 +
 +
==[[Debian]]==
 +
[https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-debian-10 How To Install and Use Docker on Debian 10]
 +
$ sudo apt update
 +
$ sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
 +
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
 +
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
 +
$ sudo apt update
 +
$ apt-cache policy docker-ce
 +
$ sudo apt install docker-ce
 +
$ sudo systemctl status docker
 +
 +
 +
==CentOS==
 +
[[CentOS]] 8 install Docker
 +
curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
 +
or yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
 +
yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
 +
yum install docker-ce
 +
systemctl start docker
  
 
==Python==
 
==Python==
第28行: 第72行:
 
*[https://github.com/docker/docker-status docker-status]
 
*[https://github.com/docker/docker-status docker-status]
 
*[https://github.com/docker/docker-registry docker-registry] 创建自己的私有注册库
 
*[https://github.com/docker/docker-registry docker-registry] 创建自己的私有注册库
 +
 +
==项目==
 +
*[https://github.com/shipyard/shipyard Shipyard]
 +
*[https://github.com/squidnyan/docker-registry-ui Docker Registry UI]
 +
*[https://github.com/kevana/ui-for-docker UI For Docker]
 +
*[[docker/seagull|Seagull]]
 +
*[https://github.com/openstack/kolla Kolla] - Deploying [[OpenStack]] using Docker
 +
 +
==部署==
 +
Docker的多种部署方式:
 +
* 通过[[OpenStack]]管理Docker,采用Nova Docker Driver方案来集成,京东采用。
 +
* 通过[[Apache Mesos]]管理Docker,Twitter、Paypal、数人云、灵雀云采用。
 +
* 通过[[kubernetes]]管理Docker,UCloud采用。
 +
* 通过[https://github.com/docker/swarm/ Docker Swarm]部署Docker集群。
 +
[http://docs.huihoo.com/infoq/qconshanghai/2015/%E5%AE%B9%E5%99%A8%E4%B8%8E%E4%BA%91%E8%AE%A1%E7%AE%97/ >>>更多细节]
 +
*[http://docs.huihoo.com/docker/OpenStack-Heat+Docker.pdf Docker plugin for Heat]
 +
*[https://github.com/ContainerSolutions/ImageWolf ImageWolf] - Fast Distribution of Docker Images on Clusters
  
 
==文档==
 
==文档==
 +
*[http://docs.huihoo.com/javaone/2015/CON7506-Java-EE-Application-Servers-Multitenant-or-Containerized-Both.pdf Java EE Application Servers: Multitenant or Containerized? Both!]
 +
*[http://docs.huihoo.com/javaone/2015/CON6832-Debugging-Java-Apps-in-Containers-No-Heavy-Welding-Gear-Required.pdf Debugging Java Apps in Containers: No Heavy Welding Gear Required]
 +
*[http://docs.huihoo.com/javaone/2015/BOF7537-Running-Oracle-WebLogic-Server-on-Docker-Challenges-and-Workarounds.pdf Running Oracle WebLogic Server on Docker: Challenges and Workarounds]
 +
*[http://docs.huihoo.com/go/gopherchina/2015/1-8%20Go%20%e5%9c%a8%e6%8c%81%e7%bb%ad%e4%ba%a4%e4%bb%98%e4%b8%ad%e7%9a%84%e5%ae%9e%e8%b7%b5.pdf Golang, Microservices, Continuous Delivery and Docker]
 +
*[http://docs.huihoo.com/go/gopherchina/2015/2-8%20docker%e5%8e%9f%e7%90%86%e4%b8%8e%e5%ba%94%e7%94%a8%e5%ae%9e%e8%b7%b5.pdf Docker 原理与应用实践]
 
*[http://docs.huihoo.com/infoq/archsummit/bj2015/1219/%e5%9f%ba%e7%a1%80%e6%9e%b6%e6%9e%84%e4%b9%8b%e6%8a%80%e6%9c%af%e6%bc%94%e8%bf%9b%ef%bc%88%e5%8e%82%e5%95%86%e5%85%b1%e5%bb%ba%e4%b8%93%e9%a2%98%ef%bc%89/ArchSummit%e5%8c%97%e4%ba%ac-%e3%80%8aDocker%e6%9e%b6%e6%9e%84%e4%b8%8b%e7%a7%81%e6%9c%89%e4%ba%91%e7%9a%84%e6%9c%ba%e9%81%87%e4%b8%8e%e6%8c%91%e6%88%98%e3%80%8b-%e7%8e%8b%e6%8c%af%e5%a8%81.pdf Docker架构私有云的机遇和挑战]
 
*[http://docs.huihoo.com/infoq/archsummit/bj2015/1219/%e5%9f%ba%e7%a1%80%e6%9e%b6%e6%9e%84%e4%b9%8b%e6%8a%80%e6%9c%af%e6%bc%94%e8%bf%9b%ef%bc%88%e5%8e%82%e5%95%86%e5%85%b1%e5%bb%ba%e4%b8%93%e9%a2%98%ef%bc%89/ArchSummit%e5%8c%97%e4%ba%ac-%e3%80%8aDocker%e6%9e%b6%e6%9e%84%e4%b8%8b%e7%a7%81%e6%9c%89%e4%ba%91%e7%9a%84%e6%9c%ba%e9%81%87%e4%b8%8e%e6%8c%91%e6%88%98%e3%80%8b-%e7%8e%8b%e6%8c%af%e5%a8%81.pdf Docker架构私有云的机遇和挑战]
 
*[http://docs.huihoo.com/infoq/archsummit/bj2015/1219/UCloud%e6%8a%80%e6%9c%af%e4%b8%93%e5%9c%ba%ef%bc%9a%e4%bc%81%e4%b8%9a%e5%ae%b9%e5%99%a8%e5%8c%96%e5%ba%94%e7%94%a8%e5%ae%9e%e8%b7%b5%ef%bc%88%e5%8e%82%e5%95%86%e5%85%b1%e5%bb%ba%e4%b8%93%e9%a2%98%ef%bc%89/ArchSummit%e5%8c%97%e4%ba%ac-%e3%80%8a%e7%bb%8f%e9%aa%8c%e5%88%86%e4%ba%ab%ef%bc%9a%e5%a4%a7%e4%bc%97%e7%82%b9%e8%af%84%e7%a7%81%e6%9c%89%e4%ba%91%e5%b9%b3%e5%8f%b0%e4%b9%8bDocker%e5%ae%9e%e8%b7%b5%e3%80%8b-%e7%9b%9b%e5%bb%b6%e6%95%8f.pdf 经验分享:大众点评私有云平台之Docker实践]
 
*[http://docs.huihoo.com/infoq/archsummit/bj2015/1219/UCloud%e6%8a%80%e6%9c%af%e4%b8%93%e5%9c%ba%ef%bc%9a%e4%bc%81%e4%b8%9a%e5%ae%b9%e5%99%a8%e5%8c%96%e5%ba%94%e7%94%a8%e5%ae%9e%e8%b7%b5%ef%bc%88%e5%8e%82%e5%95%86%e5%85%b1%e5%bb%ba%e4%b8%93%e9%a2%98%ef%bc%89/ArchSummit%e5%8c%97%e4%ba%ac-%e3%80%8a%e7%bb%8f%e9%aa%8c%e5%88%86%e4%ba%ab%ef%bc%9a%e5%a4%a7%e4%bc%97%e7%82%b9%e8%af%84%e7%a7%81%e6%9c%89%e4%ba%91%e5%b9%b3%e5%8f%b0%e4%b9%8bDocker%e5%ae%9e%e8%b7%b5%e3%80%8b-%e7%9b%9b%e5%bb%b6%e6%95%8f.pdf 经验分享:大众点评私有云平台之Docker实践]
第39行: 第105行:
 
*[http://docs.huihoo.com/infoq/en/QConLondon-cluster-management-google-201502.pdf Google 容器引擎 Run Docker containers on Google Cloud Platform, powered by Kubernetes,每周启动超过20亿个容器]
 
*[http://docs.huihoo.com/infoq/en/QConLondon-cluster-management-google-201502.pdf Google 容器引擎 Run Docker containers on Google Cloud Platform, powered by Kubernetes,每周启动超过20亿个容器]
 
*[http://docs.huihoo.com/infoq/qconbeijing/2015/day2/%EF%BF%BC%EF%BF%BC%E5%9F%BA%E4%BA%8EDocker%E5%AE%B9%E5%99%A8%E7%9A%84%E4%BA%91%E8%AE%A1%E7%AE%97%E5%B9%B3%E5%8F%B0%E6%90%AD%E5%BB%BA%E5%AE%9E%E6%88%98.pdf 基于Docker容器的云计算平台搭建实战]
 
*[http://docs.huihoo.com/infoq/qconbeijing/2015/day2/%EF%BF%BC%EF%BF%BC%E5%9F%BA%E4%BA%8EDocker%E5%AE%B9%E5%99%A8%E7%9A%84%E4%BA%91%E8%AE%A1%E7%AE%97%E5%B9%B3%E5%8F%B0%E6%90%AD%E5%BB%BA%E5%AE%9E%E6%88%98.pdf 基于Docker容器的云计算平台搭建实战]
 +
*[http://docs.huihoo.com/docker/Baidu-BAE-and-Docker.pdf Docker在百度BAE的实战分享]、[http://docs.huihoo.com/docker/Docker-in-pratice-from-Baidu.pdf 英文版本]
 +
*[http://docs.huihoo.com/docker/Docker-at-Spotify.pdf Docker at Spotify]
 +
[http://docs.huihoo.com/docker/ >>>更多幻灯片]
  
 
==图书==
 
==图书==
第57行: 第126行:
 
*爱奇艺在基于[[Apache Mesos]]、Docker 等技术构建私有 App Engine。
 
*爱奇艺在基于[[Apache Mesos]]、Docker 等技术构建私有 App Engine。
 
*美团云Docker
 
*美团云Docker
 +
[https://www.docker.com/customers >>>更多用户]
  
 
==开发==
 
==开发==
第68行: 第138行:
 
<gallery>
 
<gallery>
 
image:Container-ecosystem.png|容器生态系统
 
image:Container-ecosystem.png|容器生态系统
 +
image:Docker-Container-App-Lifecycle.png|Docker应用生命周期
 
image:docker-architecture.jpg|架构
 
image:docker-architecture.jpg|架构
 
image:what-is-docker.png|Docker是什么
 
image:what-is-docker.png|Docker是什么
第73行: 第144行:
 
image:virtual-machine-and-container.png|虚拟机和容器
 
image:virtual-machine-and-container.png|虚拟机和容器
 
image:docker-and-openstack.png|OpenStack
 
image:docker-and-openstack.png|OpenStack
 +
image:openstack-docker-hadoop.png|与OpenStack/Hadoop的融合
 
image:docker-and-lxc.png|Docker和LXC的关系
 
image:docker-and-lxc.png|Docker和LXC的关系
 
image:docker-at-redhat.png|红帽的方向
 
image:docker-at-redhat.png|红帽的方向
第79行: 第151行:
 
image:docker-integrated-jenkins.png|集成Jenkins
 
image:docker-integrated-jenkins.png|集成Jenkins
 
image:iaas-vs-paas.png|IaaS和PaaS
 
image:iaas-vs-paas.png|IaaS和PaaS
 +
image:openshift-all-in-one.png|OpenShift
 +
image:Red-Hat-Container-Stack.png|红帽容器堆栈
 +
image:OpenShift-Kubernetes-Docker-HDP.png|容器PaaS与大数据
 +
image:aliyun-docker-repo.png|阿里Docker镜像加速器
 +
image:harbor-cephfs.png|Harbor私有容器仓库
 +
image:data-containers.jpg|数据容器
 
</gallery>
 
</gallery>
  
第84行: 第162行:
 
*[https://www.docker.io/ Docker官网]
 
*[https://www.docker.io/ Docker官网]
 
*[https://github.com/dotcloud/docker Docker @ GitHub]
 
*[https://github.com/dotcloud/docker Docker @ GitHub]
*[https://www.dockboard.org Docker中文社区]
+
*[https://htmlpreview.github.io/?https://github.com/redhat-developer/docker-java/blob/javaone2015/readme.html Docker for Java Developers]
 +
*[https://github.com/veggiemonk/awesome-docker Awesome Docker] [[image:awesome.png]]
 +
*[https://github.com/Friz-zy/awesome-linux-containers Awesome Linux Containers] [[image:awesome.png]]
 +
*[http://dockone.io/ DockOne.io]
 
*[https://wiki.openstack.org/wiki/Docker Docker for OpenStack]
 
*[https://wiki.openstack.org/wiki/Docker Docker for OpenStack]
 
*[https://github.com/dotcloud/docker/tree/master/hack/infrastructure Docker project infrastructure]
 
*[https://github.com/dotcloud/docker/tree/master/hack/infrastructure Docker project infrastructure]
第105行: 第186行:
 
*[http://segmentfault.com/a/1190000002989928 如何使用 Docker 组件开发 Django 项目?]
 
*[http://segmentfault.com/a/1190000002989928 如何使用 Docker 组件开发 Django 项目?]
 
*[https://github.com/jcloudpub/speedy Speedy:来自京东的Docker镜像存储系统]
 
*[https://github.com/jcloudpub/speedy Speedy:来自京东的Docker镜像存储系统]
 +
*[https://blog.openshift.com/openshift-v3-deep-dive-docker-kubernetes/ OpenShift V3 Deep Dive Tutorial | The Next Generation of PaaS]
 +
*[http://www.youruncloud.com/blog/105.html 当微服务遇见容器] [http://www.youruncloud.com/blog/100.html Docker定义存储-让应用无痛运行]
  
 +
[[category:virtualization]]
 +
[[category:container]]
 
[[category:cloud computing]]
 
[[category:cloud computing]]
 +
[[category:microservices]]
 
[[category:linux]]
 
[[category:linux]]
 
[[category:OpenStack]]
 
[[category:OpenStack]]
 
[[category:go]]
 
[[category:go]]
[[category:huihoo]]
 

2022年1月14日 (五) 05:06的最后版本

Docker: the Linux container engine

Docker是一款基于轻量级虚拟化技术的容器引擎,使用 Go 语言开发,采用 Apache V2 许可协议。

Docker可以在容器内部快速自动化部署应用,并可以通过内核虚拟化技术(namespaces及cgroups等)来提供容器的资源隔离与安全保障等。由于Docker通过操作系统层的虚拟化实现隔离,所以Docker容器在运行时,不需要类似虚拟机(VM)额外的操作系统开销,提高资源利用率,并且提升诸如IO等方面的性能。

OpenStack也在其最新发行版(代号Havana)中引入了Docker。

Docker-logo.png

目录

[编辑] 原理

Docker 是封装自 LXCcgroup 的虚拟化技术。

Docker的overlay存储驱动建立在OverlayFS文件系统之上,它允许将一个文件系统与另一个文件系统重叠(overlay),在上层的文件系统中记录更改,而下层的文件系统保持不变,OverlayFS从Linux 3.18版本以后已进入内核主线。

[编辑] 指南

下载Docker,如macOS

Docker Toolbox包含:

  • Docker Client
  • Docker Machine
  • Docker Compose
  • Docker Kitematic
  • VirtualBox

下载安装Docker Toolbox

$ docker version
$ docker-machine version
$ docker-compose version
$ docker run debian /bin/echo hello world

一些配置参考:cat /etc/docker/daemon.json

{
  "registry-mirrors": ["https://registry.docker-cn.com"],
  "insecure-registries": ["172.30.2.245:5000"],
  "exec-opts": ["native.cgroupdriver=systemd"]
}

进入一个正在运行容器,如:

docker exec -t -i <id/container_name>  /bin/bash

清理所有Docker容器、容器卷和镜像 How To Remove Docker Images, Containers, and Volumes

docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
docker rmi -f $(docker images -q)

清除所有未使用或悬挂(Unused or Dangling)的镜像、容器、卷和网络

docker container prune
docker system prune

[编辑] Debian

How To Install and Use Docker on Debian 10

$ sudo apt update
$ sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
$ sudo apt update
$ apt-cache policy docker-ce
$ sudo apt install docker-ce
$ sudo systemctl status docker


[编辑] CentOS

CentOS 8 install Docker

curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
or yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
yum install docker-ce
systemctl start docker

[编辑] Python

[编辑] 项目

[编辑] 部署

Docker的多种部署方式:

  • 通过OpenStack管理Docker,采用Nova Docker Driver方案来集成,京东采用。
  • 通过Apache Mesos管理Docker,Twitter、Paypal、数人云、灵雀云采用。
  • 通过kubernetes管理Docker,UCloud采用。
  • 通过Docker Swarm部署Docker集群。

>>>更多细节

[编辑] 文档

>>>更多幻灯片

[编辑] 图书

[编辑] 用户

>>>更多用户

[编辑] 开发

[编辑] 服务商

[编辑] 图集

[编辑] 链接

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱