Method: Docker::Compose::Session#run!
- Defined in:
- lib/docker/compose/session.rb
#run!(*args) ⇒ String
Run a docker-compose command without validating that the CLI parameters make sense. Prepend project and file options if suitable.
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/docker/compose/session.rb', line 256 def run!(*args) project_name_args = if @project_name [{ project_name: @project_name }] else [] end file_args = case @file when 'docker-compose.yml' [] when Array # backticks sugar can't handle array values; build a list of hashes # IMPORTANT: preserve the order of the files so overrides work correctly file_args = @file.map { |filepath| { :file => filepath } } else # a single String (or Pathname, etc); use normal sugar to add it [{ file: @file.to_s }] end @shell.chdir = dir @last_command = @shell.run('docker-compose', *project_name_args, *file_args, *args).join status = @last_command.status out = @last_command.captured_output err = @last_command.captured_error status.success? || fail(Error.new(args.first, status, out+err)) out end |