lib/eac_docker/container.rb in eac_docker-0.3.0 vs lib/eac_docker/container.rb in eac_docker-0.4.0

- old
+ new

@@ -5,11 +5,11 @@ module EacDocker class Container enable_immutable immutable_accessor :interactive, :temporary, :tty, type: :boolean immutable_accessor :env, type: :hash - immutable_accessor :command_arg, :volume, type: :array + immutable_accessor :capability, :command_arg, :volume, type: :array attr_reader :id common_constructor :image def immutable_constructor_args [image] @@ -41,12 +41,12 @@ def run_command ::EacDocker::Executables.docker.command('run', *run_command_args) end def run_command_args - run_command_boolean_args + run_command_envs_args + run_command_volumes_args + [image.id] + - command_args + run_command_boolean_args + run_command_capabilities_args + run_command_envs_args + + run_command_volumes_args + [image.provide.id] + command_args end def stop ::EacDocker::Executables.docker.command('stop', id).execute! end @@ -59,9 +59,13 @@ r = [] r << '--interactive' if interactive? r << '--tty' if tty? r << '--rm' if temporary? r + end + + def run_command_capabilities_args + capabilities.flat_map { |capability| ['--cap-add', capability] } end def run_command_volumes_args volumes.flat_map { |volume| ['--volume', volume] } end