github.com/boynux/docker@v1.11.0-rc4/docs/admin/chef.md (about)

     1  <!--[metadata]>
     2  +++
     3  aliases = ["/engine/articles/chef/"]
     4  title = "Using Chef"
     5  description = "Installation and using Docker via Chef"
     6  keywords = ["chef, installation, usage, docker,  documentation"]
     7  [menu.main]
     8  parent = "engine_admin"
     9  +++
    10  <![end-metadata]-->
    11  
    12  # Using Chef
    13  
    14  > **Note**:
    15  > Please note this is a community contributed installation path.
    16  
    17  ## Requirements
    18  
    19  To use this guide you'll need a working installation of
    20  [Chef](https://www.chef.io/). This cookbook supports a variety of
    21  operating systems.
    22  
    23  ## Installation
    24  
    25  The cookbook is available on the [Chef Supermarket](https://supermarket.chef.io/cookbooks/docker) and can be
    26  installed using your favorite cookbook dependency manager.
    27  
    28  The source can be found on
    29  [GitHub](https://github.com/someara/chef-docker).
    30  
    31  Usage
    32  -----
    33  - Add ```depends 'docker', '~> 2.0'``` to your cookbook's metadata.rb
    34  - Use resources shipped in cookbook in a recipe, the same way you'd
    35    use core Chef resources (file, template, directory, package, etc).
    36  
    37  ```ruby
    38  docker_service 'default' do
    39    action [:create, :start]
    40  end
    41  
    42  docker_image 'busybox' do
    43    action :pull
    44  end
    45  
    46  docker_container 'an echo server' do
    47    repo 'busybox'
    48    port '1234:1234'
    49    command "nc -ll -p 1234 -e /bin/cat"
    50  end
    51  ```
    52  
    53  ## Getting Started
    54  Here's a quick example of pulling the latest image and running a
    55  container with exposed ports.
    56  
    57  ```ruby
    58  # Pull latest image
    59  docker_image 'nginx' do
    60    tag 'latest'
    61    action :pull
    62  end
    63  
    64  # Run container exposing ports
    65  docker_container 'my_nginx' do
    66    repo 'nginx'
    67    tag 'latest'
    68    port '80:80'
    69    binds [ '/some/local/files/:/etc/nginx/conf.d' ]
    70    host_name 'www'
    71    domain_name 'computers.biz'
    72    env 'FOO=bar'
    73    subscribes :redeploy, 'docker_image[nginx]'
    74  end
    75  ```