{"record":{"id":"91df8ddf1321a0e2","repo":"hashicorp/vagrant","slug":"nfs-requires-a-host-only-network-to-be-created-pl","errorCode":null,"errorMessage":"NFS requires a host-only network to be created.\nPlease add a host-only network to the machine (with either DHCP or a\nstatic IP) for NFS to work.","messagePattern":"NFS requires a host-only network to be created\\.\nPlease add a host-only network to the machine \\(with either DHCP or a\nstatic IP\\) for NFS to work\\.","errorType":"exception","errorClass":"Vagrant::Errors::NFSNoHostonlyNetwork","httpStatus":null,"severity":"error","filePath":"plugins/providers/docker/action/prepare_nfs_settings.rb","lineNumber":52,"sourceCode":"          @machine.config.vm.synced_folders.any? { |_, opts| opts[:type] == :nfs }\n        end\n\n        def privileged_container?\n          @machine.provider.driver.privileged?(@machine.id)\n        end\n\n        # Extracts the proper host and guest IPs for NFS mounts and stores them\n        # in the environment for the SyncedFolder action to use them in\n        # mounting.\n        #\n        # The ! indicates that this method modifies its argument.\n        def add_ips_to_env!(env)\n          provider = env[:machine].provider\n\n          host_ip    = provider.driver.docker_bridge_ip\n          machine_ip = provider.ssh_info[:host]\n\n          raise Vagrant::Errors::NFSNoHostonlyNetwork if !host_ip || !machine_ip\n\n          env[:nfs_host_ip]    = host_ip\n          env[:nfs_machine_ip] = machine_ip\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":34,"sourceCodeEnd":61,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/docker/action/prepare_nfs_settings.rb#L34-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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\""],"exampleFix":"# before\nconfig.vm.synced_folder \".\", \"/vagrant\", type: \"nfs\"\n\n# after (no docker bridge available)\nconfig.vm.synced_folder \".\", \"/vagrant\", type: \"rsync\"","handlingStrategy":"validation","validationCode":"# NFS preflight for the docker provider\nip addr show docker0 >/dev/null 2>&1 || echo 'no docker0 bridge: NFS setup will fail'\nvagrant ssh -c true >/dev/null 2>&1 || echo 'machine not reachable: bring it up first'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["vagrant","docker","nfs","synced-folders","network"],"backgroundTag":"nfs-network-missing","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}