非常教程

Docker 17参考手册

引擎: 管理员指南 | Engine: Admin Guide

使用Puppet(引擎) | Using Puppet (Engine)

请注意,这是社区提供的安装路径。唯一official安装使用乌本图安装路径。这个版本有时可能过时了。

所需

要使用本指南,您将需要从木偶实验室...

该模块目前也使用正式的PPA,因此只适用于Ubuntu。

安装

模块可在木偶锻造并可使用内置模块工具安装。

$ puppet module install garethr/docker

它也可以在GitHub如果你想下载源代码的话。

使用

该模块提供了一个用于安装Docker的傀儡类和两个用于管理映像和容器的定义类型。

安装

include 'docker'

图像

下一步可能是安装Docker映像。为此,我们有一个定义的类型,可以这样使用:

docker::image { 'ubuntu': }

这相当于运行:

$ docker pull ubuntu

请注意,只有当该名称的图像不存在时才会下载。这是下载一个大的二进制文件,所以在第一次运行可能需要一段时间。由于这个原因,这个定义关闭了EXEC类型的默认5分钟超时。请注意,您还可以删除不再需要的图像:

docker::image { 'ubuntu':
  ensure => 'absent',
}

集装箱

现在,您可以在由Docker管理的容器中运行命令。

docker::run { 'helloworld':
  image   => 'ubuntu',
  command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
}

这相当于运行以下命令,但在upstart下:

$ docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"

Run还包含一些可选参数:

docker::run { 'helloworld':
  image        => 'ubuntu',
  command      => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
  ports        => ['4444', '4555'],
  volumes      => ['/var/lib/couchdb', '/var/log'],
  volumes_from => '6446ea52fbc9',
  memory_limit => 10485760, # bytes
  username     => 'example',
  hostname     => 'example.com',
  env          => ['FOO=BAR', 'FOO2=BAR2'],
  dns          => ['8.8.8.8', '8.8.4.4'],
}

*ports,,,env,,,dns,和volumes属性可以用单个字符串设置,也可以像上面那样使用一个值数组来设置。

木偶,安装,使用,码头工人,文献资料

引擎: 管理员指南 | Engine: Admin Guide相关

1.Amazon CloudWatch记录日志记录驱动程序(引擎) | Amazon CloudWatch logs logging driver (Engine)
2. 绑定挂载 | Bind mounts (Engine)
3.使用Prometheus(引擎)收集Docker指标 | Collect Docker metrics with Prometheus (Engine)
4.配置和运行Docker(引擎) | Configuring and running Docker (Engine)
5.配置日志记录驱动程序 | Configuring logging drivers (Engine)
6.使用systemd控制和配置Docker(引擎) | Control and configure Docker with systemd (Engine)
7.ETW日志记录驱动程序(引擎) | ETW logging driver (Engine)
8.流利的日志驱动程序(引擎) | Fluentd logging driver (Engine)
9.格式化命令和日志输出(引擎) | Format command and log output (Engine)
10.Google Cloud日志记录驱动程序(引擎) | Google Cloud logging driver (Engine)
11.Graylog扩展格式(GELF)日志记录驱动程序(引擎) | Graylog Extended Format (GELF) logging driver (Engine)
12.Journald日志记录驱动程序(引擎) | Journald logging driver (Engine)
13.JSON文件日志记录驱动程序(引擎) | JSON File logging driver (Engine)
14.在守护进程停机期间保持容器处于活动状态(引擎) | Keep containers alive during daemon downtime (Engine)
15.限制容器的资源(引擎) | Limit a container's resources (Engine)
16.通过大使容器链接(引擎) | Link via an ambassador container (Engine)
17.记录驱动程序的日志标记(引擎) | Log tags for logging driver (Engine)
18.Logentries日志驱动程序(引擎) | Logentries logging driver (Engine)
19.PowerShell DSC用法(引擎) | PowerShell DSC usage (Engine)
20.修剪未使用的Docker对象(引擎) | Prune unused Docker objects (Engine)
21.在容器中运行多个服务(引擎) | Run multiple services in a container (Engine)
22.运行时指标(引擎) | Runtime metrics (Engine)
23.Splunk日志记录驱动程序(引擎) | Splunk logging driver (Engine)
24.自动启动容器(引擎) | Start containers automatically (Engine)
25.存储概述(引擎) | Storage overview (Engine)
26.Syslog日志记录驱动程序(引擎) | Syslog logging driver (Engine)
27.tmpfs mounts
28.解决卷问题(引擎) | Troubleshoot volume problems (Engine)
29.使用日志驱动程序插件(引擎) | Use a logging driver plugin (Engine)
30.使用Ansible(引擎) | Using Ansible (Engine)
31.使用Chef(引擎) | Using Chef (Engine)
32.查看容器的日志(引擎) | View a container's logs (Engine)
33.Volumes (Engine)
Docker 17

Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。

主页 https://docker.com/
源码 https://github.com/docker/docker
版本 17
发布版本 17.06