<commit_before># chef-docker [![Build Status](https://secure.travis-ci.org/bflad/chef-docker.png?branch=master)](http://travis-ci.org/bflad/chef-docker)

## Description

Installs/Configures [Docker](http://docker.io). Please see [COMPATIBILITY.md](COMPATIBILITY.md) for more information about Docker versions that are tested and supported by cookbook versions along with LWRP features.

This cookbook was inspired by @thoward's docker-cookbook: https://github.com/thoward/docker-cookbook

## Requirements

### Platforms

* Ubuntu 12.04
* Ubuntu 12.10
* Ubuntu 13.04

### Cookbooks

[Opscode Cookbooks](https://github.com/opscode-cookbooks/)

* [apt](https://github.com/opscode-cookbooks/apt)
* [git](https://github.com/opscode-cookbooks/git)

Third-Party Cookbooks

* [golang](https://github.com/NOX73/chef-golang)
* [lxc](https://github.com/hw-cookbooks/lxc)
* [modules](https://github.com/Youscribe/modules-cookbook)

## Attributes

These attributes are under the `node['docker']` namespace.

Attribute | Description | Type | Default
----------|-------------|------|--------
arch | Architecture for docker binary (note: Docker only currently supports x86_64) | String | auto-detected (see attributes/default.rb)
http_proxy | HTTP_PROXY environment variable | String | nil
install_dir | Installation directory for docker binary | String | auto-detected (see attributes/default.rb)
install_type | Installation type for docker ("binary", "package" or "source") | String | "package"
bind_uri | The location that docker should bind to. | String | tcp://0.0.0.0:4243 (docker default)
options | Additional options to pass to docker. These could be flags like "-api-enable-cors". | String | nil

### Binary Attributes

These attributes are under the `node['docker']['binary']` namespace.

Attribute | Description | Type | Default
----------|-------------|------|--------
version | Version of docker binary | String | latest
url | URL for downloading docker binary | String | auto-detected (see attributes/default.rb)

### Package Attributes

These attributes are under the `node['docker']['package']` namespace.

Attribute | Description | Type | Default
----------|-------------|------|--------
distribution | Distribution for docker packages | String | auto-detected (see attributes/default.rb)
repo_url | Repository URL for docker packages | String | auto-detected (see attributes/default.rb)

### Source Attributes

These attributes are under the `node['docker']['source']` namespace.

Attribute | Description | Type | Default
----------|-------------|------|--------
ref | Repository reference for docker source | String | "master"
url | Repository URL for docker source | String | "https://github.com/dotcloud/docker.git"

## Recipes

* `recipe[docker]` Installs/Configures Docker
* `recipe[docker::aufs]` Installs/Loads AUFS Linux module
* `recipe[docker::binary]` Installs Docker binary
* `recipe[docker::package]` Installs Docker via package
* `recipe[docker::source]` Installs Docker via source
* `recipe[docker::upstart]` Installs/Starts Docker via Upstart

## LWRPs

### docker_container

Run a container:

    docker_container "busybox" do
      command "sleep 9999"
      detach true
    end

Stop a running container:

    docker_container "busybox" do
      command "sleep 9999"
      action :stop
    end

Start a stopped container:

    docker_container "busybox" do
      command "sleep 9999"
      action :start
    end

Restart a container:

    docker_container "busybox" do
      command "sleep 9999"
      action :restart
    end

Remove a container:

    docker_container "busybox" do
      command "sleep 9999"
      action :remove
    end

### docker_image

Build image from Dockerfile:

    docker_image "myImage" do
      tag "myTag"
      dockerfile myImageDockerfile
      action :build
    end

Pull latest image:

    docker_image "busybox"

Pull tagged image:

    docker_image "bflad/test" do
      tag "not-latest"
    end

Remove image:

    docker_image "busybox" do
      action :remove
    end

## Usage

### Default Installation

* Add `recipe[docker]` to your node's run list

## Testing and Development

### Vagrant

Here's how you can quickly get testing or developing against the cookbook thanks to [Vagrant](http://vagrantup.com/) and [Berkshelf](http://berkshelf.com/).
<commit_msg>README updates for new LWRP functionality<commit_after># chef-docker [![Build Status](https://secure.travis-ci.org/bflad/chef-docker.png?branch=master)](http://travis-ci.org/bflad/chef-docker)

## Description

Installs/Configures [Docker](http://docker.io). Please see [COMPATIBILITY.md](COMPATIBILITY.md) for more information about Docker versions that are tested and supported by cookbook versions along with LWRP features.

This cookbook was inspired by @thoward's docker-cookbook: https://github.com/thoward/docker-cookbook

## Requirements

### Platforms

* Ubuntu 12.04
* Ubuntu 12.10
* Ubuntu 13.04

### Cookbooks

[Opscode Cookbooks](https://github.com/opscode-cookbooks/)

* [apt](https://github.com/opscode-cookbooks/apt)
* [git](https://github.com/opscode-cookbooks/git)

Third-Party Cookbooks

* [golang](https://github.com/NOX73/chef-golang)
* [lxc](https://github.com/hw-cookbooks/lxc)
* [modules](https://github.com/Youscribe/modules-cookbook)

## Attributes

These attributes are under the `node['docker']` namespace.

Attribute | Description | Type | Default
----------|-------------|------|--------
arch | Architecture for docker binary (note: Docker only currently supports x86_64) | String | auto-detected (see attributes/default.rb)
http_proxy | HTTP_PROXY environment variable | String | nil
install_dir | Installation directory for docker binary | String | auto-detected (see attributes/default.rb)
install_type | Installation type for docker ("binary", "package" or "source") | String | "package"
bind_uri | The location that docker should bind to. | String | tcp://0.0.0.0:4243 (docker default)
options | Additional options to pass to docker. These could be flags like "-api-enable-cors". | String | nil

### Binary Attributes

These attributes are under the `node['docker']['binary']` namespace.

Attribute | Description | Type | Default
----------|-------------|------|--------
version | Version of docker binary | String | latest
url | URL for downloading docker binary | String | auto-detected (see attributes/default.rb)

### Package Attributes

These attributes are under the `node['docker']['package']` namespace.

Attribute | Description | Type | Default
----------|-------------|------|--------
distribution | Distribution for docker packages | String | auto-detected (see attributes/default.rb)
repo_url | Repository URL for docker packages | String | auto-detected (see attributes/default.rb)

### Source Attributes

These attributes are under the `node['docker']['source']` namespace.

Attribute | Description | Type | Default
----------|-------------|------|--------
ref | Repository reference for docker source | String | "master"
url | Repository URL for docker source | String | "https://github.com/dotcloud/docker.git"

## Recipes

* `recipe[docker]` Installs/Configures Docker
* `recipe[docker::aufs]` Installs/Loads AUFS Linux module
* `recipe[docker::binary]` Installs Docker binary
* `recipe[docker::package]` Installs Docker via package
* `recipe[docker::source]` Installs Docker via source
* `recipe[docker::upstart]` Installs/Starts Docker via Upstart

## LWRPs

### docker_container

Run a container:

    docker_container "busybox" do
      command "sleep 9999"
      detach true
    end

Stop a running container:

    docker_container "busybox" do
      command "sleep 9999"
      action :stop
    end

Start a stopped container:

    docker_container "busybox" do
      command "sleep 9999"
      action :start
    end

Restart a container:

    docker_container "busybox" do
      command "sleep 9999"
      action :restart
    end

Remove a container:

    docker_container "busybox" do
      command "sleep 9999"
      action :remove
    end

### docker_image

Build image from Dockerfile:

    docker_image "myImage" do
      tag "myTag"
      dockerfile myImageDockerfile
      action :build
    end

Build image from remote repository:

    docker_image "myImage" do
      image_url "example.com/foo/myImage"
      tag "myTag"
      action :build
    end

Pull latest image:

    docker_image "busybox"

Pull tagged image:

    docker_image "bflad/test" do
      tag "not-latest"
    end

Import image from URL:

    docker_image "test" do
      image_url "https://example.com/testimage.tgz"
      action :import
    end

Import image from URL with repository/tag information:

    docker_image "test" do
      image_url "https://example.com/testimage.tgz"
      repository "bflad/test"
      tag "not-latest"
      action :import
    end

Remove image:

    docker_image "busybox" do
      action :remove
    end

## Usage

### Default Installation

* Add `recipe[docker]` to your node's run list

## Testing and Development

### Vagrant

Here's how you can quickly get testing or developing against the cookbook thanks to [Vagrant](http://vagrantup.com/) and [Berkshelf](http://berkshelf.com/).

{'fraction_non_alphanumeric': 0.13835929839851835, 'fraction_numerical': 0.010022878309184007, 'mean_word_length': 3.478048780487805, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3763398', 'n_tokens_mistral': 2916, 'n_tokens_neox': 2661, 'n_words': 823}