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