{"record":{"id":"9af6fff28bd67e24","repo":"hashicorp/vagrant","slug":"docker-installation-failed","errorCode":null,"errorMessage":"Docker installation failed.","messagePattern":"Docker installation failed\\.","errorType":"exception","errorClass":"VagrantPlugins::DockerProvisioner::DockerError","httpStatus":null,"severity":"error","filePath":"plugins/provisioners/docker/installer.rb","lineNumber":26,"sourceCode":"    class Installer < VagrantPlugins::ContainerProvisioner::Installer\n      # This handles verifying the Docker installation, installing it if it was\n      # requested, and so on. This method will raise exceptions if things are\n      # wrong.\n      # @return [Boolean] - false if docker cannot be detected on machine, else\n      #                     true if docker installs correctly or is installed\n      def ensure_installed\n        if !@machine.guest.capability?(:docker_installed)\n          @machine.ui.warn(I18n.t(\"vagrant.docker_cant_detect\"))\n          return false\n        end\n\n        if !@machine.guest.capability(:docker_installed)\n          @machine.ui.detail(I18n.t(\"vagrant.docker_installing\"))\n          @machine.guest.capability(:docker_install)\n        end\n\n        if !@machine.guest.capability(:docker_installed)\n          raise DockerError, :install_failed\n        end\n\n        if @machine.guest.capability?(:docker_configure_vagrant_user)\n          @machine.guest.capability(:docker_configure_vagrant_user)\n        end\n\n        true\n      end\n    end\n  end\nend\n","sourceCodeStart":8,"sourceCodeEnd":38,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/provisioners/docker/installer.rb#L8-L38","documentation":"Raised by the Docker installer's ensure_installed: if the guest lacks the `docker_installed` capability it only warns and returns false (provisioning continues without docker management); but when the capability exists, installation runs (`docker_install`), and a follow-up `docker_installed` check still reporting absence triggers install_failed. The installer output streamed before the raise contains the actual package-manager error from inside the guest.","triggerScenarios":"Docker provisioner on a guest where `docker_install` ran (apt/yum/dnf script) but the post-install check cannot find a working docker binary - failed downloads, unsupported distro version, broken package repos, or docker installed to a non-standard location the capability does not probe.","commonSituations":"Corporate proxy blocking download.docker.com in the guest; very new/old distro release without a repo entry; apt lock or disk-full during install; minimal images where the install script silently failed.","solutions":["Read the installer output above the raise - it shows the package manager failure","SSH in and retry manually to see the error: `vagrant ssh -c 'sudo apt-get install docker-ce'` (or dnf/yum)","Fix guest network/proxy/DNS and run `vagrant provision` again","Preinstall Docker in a custom box; the capability check then passes and install is skipped"],"exampleFix":"# Vagrantfile - before\nconfig.vm.provision \"docker\"\n\n# Vagrantfile - after (pre-provision the repo so the installer works)\nconfig.vm.provision \"shell\", inline: <<-SHELL\n  apt-get update && apt-get install -y ca-certificates curl gnupg\nSHELL\nconfig.vm.provision \"docker\"","handlingStrategy":"try-catch","validationCode":"# Pre-flight from host: can the guest reach the docker repo?\nsystem(\"vagrant ssh -c 'curl -sI https://download.docker.com >/dev/null && echo OK'\") or\n  abort \"Guest cannot reach download.docker.com - docker install will fail\"","typeGuard":null,"tryCatchPattern":"begin\n  env.cli(%w[provision])\nrescue VagrantPlugins::DockerProvisioner::DockerError => e\n  abort \"Docker install failed: run `vagrant ssh -c 'sudo journalctl -u docker'` and fix guest network\" if e.message == \"Docker installation failed.\"\n  raise\nend","preventionTips":["Bake docker-ce into your base box for CI images; skips install entirely","Warm the guest's package cache with a shell provisioner before the docker provisioner","Verify guest DNS/proxy settings before first provision in restricted networks"],"tags":["docker","provisioning","vagrant","installation"],"backgroundTag":"package-installation-failed","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}