diff --git a/plugins/providers/docker/driver.rb b/plugins/providers/docker/driver.rb index 9a98d3a2d..959be42ed 100644 --- a/plugins/providers/docker/driver.rb +++ b/plugins/providers/docker/driver.rb @@ -18,12 +18,16 @@ module VagrantPlugins def build(dir, **opts, &block) args = Array(opts[:extra_args]) args << dir - result = execute('docker', 'build', '-q', *args, &block) - matches = result.scan(/^sha256:([0-9a-f]+)$/i) + result = execute('docker', 'build', '--progress', 'plain', *args, &block) + matches = result.scan(/Successfully built (.+)$/i) if matches.empty? - # This will cause a stack trace in Vagrant, but it is a bug - # if this happens anyways. - raise "UNKNOWN OUTPUT: #{result}" + # Check for the new output format 'writing image sha256...' + matches = result.scan(/writing image sha256:([0-9a-z]+) done$/i) + if matches.empty? + # This will cause a stack trace in Vagrant, but it is a bug + # if this happens anyways. + raise "UNKNOWN OUTPUT: #{result}" + end end # Return the last match, and the capture of it diff --git a/plugins/providers/docker/executor/local.rb b/plugins/providers/docker/executor/local.rb index c78e8c90e..6a71d52d5 100644 --- a/plugins/providers/docker/executor/local.rb +++ b/plugins/providers/docker/executor/local.rb @@ -27,7 +27,12 @@ module VagrantPlugins stdout: result.stdout end - result.stdout + # If the new buildkit-based docker build is used, stdout is empty, and the output is in stderr + if result.stdout.to_s.strip.length == 0 + result.stderr + else + result.stdout + end end def windows?