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
endView on GitHub (pinned to 35f3160f4a)
Solutions
- Diagnose in the guest: `vagrant ssh -c 'systemctl status docker; sudo journalctl -u docker --no-pager | tail -50'`
- Unmask/enable: `sudo systemctl unmask docker && sudo systemctl enable --now docker`, then re-provision
- On non-systemd boxes, use a systemd-enabled base image (e.g. modern official ubuntu/centos boxes)
- 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
- Use systemd-enabled boxes so docker can actually be service-managed
- Ensure docker.service is not masked in your base image (`systemctl unmask docker`)
- Give slow guests headroom: start docker once during box build so first provision is not racing daemon startup
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
- Multiple URLs for a box can't be specified when adding versi
- The Docker post-install provisioner cannot also take a Docke
- Docker installation failed.
- This Vagrant environment has specified that it requires the
- The box '%{name}' could not be found or could not be accesse
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/e8d2e8e48192a26e.
Report an issue: GitHub.