hashicorp/vagrant · error · VagrantPlugins::DockerProvider::Errors::SyncedFolderNonDocker
The "docker" synced folder type can't be used because the p
Error message
The "docker" synced folder type can't be used because the provider
in use is not Docker. This synced folder type only works with the
Docker provider. The provider this machine is using is: %{provider} What it means
The docker synced folder implementation gates on the machine's provider: usable? returns false (or raises SyncedFolderNonDocker when Vagrant performs a strict check, i.e. the type was pinned explicitly with type: "docker") whenever machine.provider_name is not :docker. The message names the offending provider.
Source
Thrown at plugins/providers/docker/synced_folder.rb:11
# Copyright IBM Corp. 2010, 2025
# SPDX-License-Identifier: BUSL-1.1
module VagrantPlugins
module DockerProvider
class SyncedFolder < Vagrant.plugin("2", :synced_folder)
def usable?(machine, raise_error=false)
# These synced folders only work if the provider is Docker
if machine.provider_name != :docker
if raise_error
raise Errors::SyncedFolderNonDocker,
provider: machine.provider_name.to_s
end
return false
end
true
end
def prepare(machine, folders, _opts)
folders.each do |id, data|
next if data[:ignore]
host_path = data[:hostpath]
guest_path = data[:guestpath]
# Append consistency option if it exists, otherwise let it nil out
consistency = data[:docker_consistency]
consistency &&= ":" + consistencyView on GitHub (pinned to 35f3160f4a)
Solutions
- Remove type: "docker" and let the active provider pick its own synced folder implementation
- Use a portable type (rsync, nfs) in shared configs
- Scope docker-typed folders to machines that actually use the docker provider
Example fix
# before config.vm.synced_folder ".", "/vagrant", type: "docker" # after config.vm.synced_folder ".", "/vagrant", type: "rsync" # or omit type and let the provider default apply
Defensive patterns
Strategy: type-guard
Type guard
def docker_synced_folder_applicable?(machine) machine.provider_name == :docker end # usage if docker_synced_folder_applicable?(machine) machine.config.vm.synced_folder ".", "/vagrant", type: "docker" end
Prevention
- Use provider-conditional blocks when sharing Vagrantfiles across providers
- Prefer omitting type: and letting each provider pick its implementation
- Reserve type: "docker" for machines pinned to the docker provider via FORCE or provider overrides
When it happens
Trigger: config.vm.synced_folder "src", "/src", type: "docker" on a machine whose provider is virtualbox, hyperv, vmware, etc. - the strict check fires because the type was forced instead of letting Vagrant choose per provider.
Common situations: One Vagrantfile shared across providers; a Docker-machine config copied onto other machines; a shared default that pins one folder type for all machines.
Related errors
- The Docker provider is unable to connect the container to th
- The Docker provider was unable to configure networking using
- Invalid option given for docker network for guest "%{contain
- NFS requires a host-only network to be created. Please add a
- Vagrant has noticed that the synced folder definitions have
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/6c707386715b7ff2.
Report an issue: GitHub.