hashicorp/vagrant · error · Vagrant::Errors::NFSNoHostonlyNetwork
NFS requires a host-only network to be created. Please add a
Error message
NFS requires a host-only network to be created. Please add a host-only network to the machine (with either DHCP or a static IP) for NFS to work.
What it means
The Docker provider's PrepareNFSSettings computes NFS endpoints as the docker bridge IP (provider.driver.docker_bridge_ip, host side) and the machine's SSH host IP (provider.ssh_info[:host], guest side). If either is nil it raises NFSNoHostonlyNetwork before any mount is attempted - there is no usable host-guest network path for NFS.
Source
Thrown at plugins/providers/docker/action/prepare_nfs_settings.rb:52
@machine.config.vm.synced_folders.any? { |_, opts| opts[:type] == :nfs }
end
def privileged_container?
@machine.provider.driver.privileged?(@machine.id)
end
# Extracts the proper host and guest IPs for NFS mounts and stores them
# in the environment for the SyncedFolder action to use them in
# mounting.
#
# The ! indicates that this method modifies its argument.
def add_ips_to_env!(env)
provider = env[:machine].provider
host_ip = provider.driver.docker_bridge_ip
machine_ip = provider.ssh_info[:host]
raise Vagrant::Errors::NFSNoHostonlyNetwork if !host_ip || !machine_ip
env[:nfs_host_ip] = host_ip
env[:nfs_machine_ip] = machine_ip
end
end
end
end
end
View on GitHub (pinned to 35f3160f4a)
Solutions
- Ensure the machine is up and `vagrant ssh` works, then retry
- Verify the default bridge exists (`ip addr show docker0`) and restore default daemon config if it was customized
- If the bridge cannot be restored, switch the folder to a type that needs no host bridge, e.g. type: "rsync"
Example fix
# before config.vm.synced_folder ".", "/vagrant", type: "nfs" # after (no docker bridge available) config.vm.synced_folder ".", "/vagrant", type: "rsync"
Defensive patterns
Strategy: validation
Validate before calling
# NFS preflight for the docker provider ip addr show docker0 >/dev/null 2>&1 || echo 'no docker0 bridge: NFS setup will fail' vagrant ssh -c true >/dev/null 2>&1 || echo 'machine not reachable: bring it up first'
Prevention
- Keep the docker daemon's default bridge (docker0) unmodified when using NFS
- Bring machines fully up before relying on NFS mounts
- Fall back to rsync folders in environments where the bridge cannot be guaranteed
When it happens
Trigger: nfs synced folders on a docker-provider machine where the docker bridge cannot be detected (custom daemon config removing docker0) or ssh_info is unavailable because the container/host VM is not up or not reachable.
Common situations: Custom docker daemon with a renamed or removed default bridge; the NFS prepare step running before the machine is reachable; a broken host VM SSH connection.
Related errors
- The synced folder type '%{type}' is reporting as unusable fo
- The Docker provider is unable to connect the container to th
- The Docker provider was unable to configure networking using
- The configured network address is not valid within the confi
- The configured network subnet is not valid for the defined n
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/91df8ddf1321a0e2.
Report an issue: GitHub.