hashicorp/vagrant · error · VagrantPlugins::DockerProvider::Errors::ExecuteError

A Docker command executed by Vagrant didn't complete success

Error message

A Docker command executed by Vagrant didn't complete successfully!
The command run along with the output from the command is shown
below.

Command: %{command}

Stderr: %{stderr}

Stdout: %{stdout}

What it means

When docker runs inside the provider's host VM, commands execute over SSH via Executor::Vagrant with streamed stdout/stderr. A non-zero exit code of the command on the guest raises ExecuteError carrying the command, stderr, and stdout captured from inside the host VM.

Source

Thrown at plugins/providers/docker/executor/vagrant.rb:62

                index += start_fence.length
                stdout = stdout[index..-1]
                stdout.chomp!

                # We're now fenced, send all the data through
                if block
                  block.call(:stdout, stdout) if stdout != ""
                  block.call(:stderr, stderr) if stderr != ""
                end
              end
            else
              # If we're already fenced, just send the data through.
              block.call(type, data) if block && fenced
            end
          end

          if code != 0
            raise Errors::ExecuteError,
              command: cmd,
              stderr: stderr.chomp,
              stdout: stdout.chomp
          end

          stdout.chomp
        end

        def windows?
          false
        end

        protected

        def ssh_run(cmd)
          @host_machine.action(
            :ssh_run,
            ssh_run_command: cmd,

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Read the Stderr: section for the in-VM docker message
  2. SSH into the host VM and verify the daemon: run `docker info` there (or use the provider's docker-env helpers)
  3. Reload the host VM to restart its docker daemon, then retry
  4. Fix the underlying failure (auth, ports, disk space) and re-run
Defensive patterns

Strategy: try-catch

Validate before calling

# preflight inside the host VM (adjust path to your host VM environment)
cd host-vm && vagrant ssh -c 'docker info >/dev/null' || vagrant reload

Try / catch

begin
  executor.execute(*cmd)
rescue VagrantPlugins::DockerProvider::Errors::ExecuteError => e
  stderr = e.extra_data[:stderr]
  if stderr.include?('Cannot connect to the Docker daemon')
    reload_host_vm_and_retry   # daemon inside the host VM is down
  else
    raise
  end
end

Prevention

When it happens

Trigger: Docker-in-host-VM setups (e.g. macOS/Windows without a local daemon) where the docker CLI fails inside the host VM: its daemon stopped, registry auth missing there, or a port already in use inside the VM.

Common situations: Host VM docker daemon stopped after a suspend/resume; host VM low on disk or memory; proxy/auth environment variables not set inside the VM.

Related errors


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/b3dfb52a9bca269b. Report an issue: GitHub.