From ed0d4dccac4b1ddb5e77e4d25f482920230ea3f6 Mon Sep 17 00:00:00 2001 From: Pavel Forkert Date: Thu, 29 Jan 2015 00:59:33 +0200 Subject: [PATCH] Add additional_host attribute to container resource It corresponds to `--add-host` CLI argument, described here: https://docs.docker.com/reference/run/. --- README.md | 1 + providers/container.rb | 1 + resources/container.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/README.md b/README.md index ffc7bb2f6d..7ae3c67f58 100644 --- a/README.md +++ b/README.md @@ -495,6 +495,7 @@ These attributes are associated with this LWRP action. Attribute | Description | Type | Default ----------|-------------|------|-------- +additional_host | Add a custom host-to-IP mapping (host:ip) | String, Array | nil attach | Attach container's stdout/stderr and forward all signals to the process | TrueClass, FalseClass | nil cidfile | File to store container ID | String | nil container_name | Name for container/service | String | nil diff --git a/providers/container.rb b/providers/container.rb index f081927607..c27972b6e2 100644 --- a/providers/container.rb +++ b/providers/container.rb @@ -361,6 +361,7 @@ def run # rubocop:disable MethodLength def run_cli_args { + 'add-host' => Array(new_resource.additional_host), 'cpu-shares' => new_resource.cpu_shares, 'cidfile' => new_resource.cidfile, 'detach' => new_resource.detach, diff --git a/resources/container.rb b/resources/container.rb index e208855db5..2757b3e0c8 100644 --- a/resources/container.rb +++ b/resources/container.rb @@ -4,6 +4,7 @@ attribute :image, :name_attribute => true +attribute :additional_host, :kind_of => [String, Array] attribute :attach, :kind_of => [TrueClass, FalseClass] attribute :author, :kind_of => [String] attribute :cidfile, :kind_of => [String]