hashicorp/vagrant · error · VagrantPlugins::DockerProvisioner::DockerError

Docker is not running on the guest VM.

Error message

Docker is not running on the guest VM.

What it means

Raised by the Docker provisioner after it calls `@client.start_service` and `@client.daemon_running?` still returns false. Everything before this point (install, post-install hook) succeeded; the failure is specifically that the docker daemon/service did not come up inside the guest - service masked, systemd not PID 1, storage-driver/kernel issues, or the daemon simply not listening yet when checked.

Source

Thrown at plugins/provisioners/docker/provisioner.rb:39

        @logger = Log4r::Logger.new("vagrant::provisioners::docker")
      end

      def provision
        @logger.info("Checking for Docker installation...")
        if @installer.ensure_installed
          if !config.post_install_provisioner.nil?
            @logger.info("Running post setup provision script...")
            env = {
                  callable: method(:run_provisioner),
                  provisioner: config.post_install_provisioner,
                  machine: machine}
            machine.env.hook(:run_provisioner, env)
          end
        end

        # Attempt to start service if not running
        @client.start_service
        raise DockerError, :not_running if !@client.daemon_running?

        if config.images.any?
          @machine.ui.info(I18n.t("vagrant.docker_pulling_images"))
          @client.pull_images(*config.images)
        end

        if config.build_images.any?
          @machine.ui.info(I18n.t("vagrant.docker_building_images"))
          @client.build_images(config.build_images)
        end

        if config.containers.any?
          @machine.ui.info(I18n.t("vagrant.docker_starting_containers"))
          @client.run(config.containers)
        end
      end

    end

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Diagnose in the guest: `vagrant ssh -c 'systemctl status docker; sudo journalctl -u docker --no-pager | tail -50'`
  2. Unmask/enable: `sudo systemctl unmask docker && sudo systemctl enable --now docker`, then re-provision
  3. On non-systemd boxes, use a systemd-enabled base image (e.g. modern official ubuntu/centos boxes)
  4. If the daemon is just slow, start it once (`vagrant ssh -c 'sudo systemctl start docker'`) and re-run `vagrant provision`

Example fix

# Guest - before
sudo systemctl mask docker   # later provision fails with not_running

# Guest - after
sudo systemctl unmask docker
sudo systemctl enable --now docker
# then on host:
# vagrant provision
Defensive patterns

Strategy: retry

Validate before calling

# From the host, confirm the daemon is up before provisioning
system("vagrant ssh -c 'sudo systemctl is-active docker'") or
  system("vagrant ssh -c 'sudo systemctl start docker'")

Try / catch

tries = 0
begin
  env.cli(%w[provision])
rescue VagrantPlugins::DockerProvisioner::DockerError => e
  tries += 1
  if e.message == "Docker is not running on the guest VM." && tries < 3
    system("vagrant ssh -c 'sudo systemctl start docker; sleep 5'")
    retry
  end
  raise
end

Prevention

When it happens

Trigger: `vagrant provision` with the docker provisioner on a guest where `systemctl start docker` fails or the socket/engine check times out: masked docker.service, non-systemd boxes (older init), missing iptables/kernel modules in the VM, daemon crash-looping (check journalctl).

Common situations: Boxes without systemd as init so start_service is a no-op; docker.service masked by a cloud image; /var/lib/docker corrupted or disk full; overlay2 unsupported on the guest kernel; daemon slow to start so the immediate check races it.

Related errors


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