{"record":{"id":"9b52f96de597284c","repo":"hashicorp/vagrant","slug":"warning-when-using-a-remote-docker-host-forwarde","errorCode":null,"errorMessage":"Warning: When using a remote Docker host, forwarded ports will NOT be\nimmediately available on your machine. They will still be forwarded on\nthe remote machine, however, so if you have a way to access the remote\nmachine, then you should be able to access those ports there. This is\nnot an error, it is only an informational message.","messagePattern":"Warning: When using a remote Docker host, forwarded ports will NOT be\nimmediately available on your machine\\. They will still be forwarded on\nthe remote machine, however, so if you have a way to access the remote\nmachine, then you should be able to access those ports there\\. This is\nnot an error, it is only an informational message\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"plugins/providers/docker/action/host_machine_port_warning.rb","lineNumber":21,"sourceCode":"\nmodule VagrantPlugins\n  module DockerProvider\n    module Action\n      class HostMachinePortWarning\n        def initialize(app, env)\n          @app = app\n        end\n\n        def call(env)\n          if !env[:machine].provider.host_vm?\n            return @app.call(env)\n          end\n\n          # If we have forwarded ports, then notify the user that they\n          # won't be immediately available unless a private network\n          # is created.\n          if has_forwarded_ports?(env[:machine])\n            env[:machine].ui.warn(I18n.t(\n              \"docker_provider.host_machine_forwarded_ports\"))\n          end\n\n          @app.call(env)\n        end\n\n        protected\n\n        def has_forwarded_ports?(machine)\n          machine.config.vm.networks.each do |type, _|\n            return true if type == :forwarded_port\n          end\n\n          false\n        end\n      end\n    end\n  end","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/docker/action/host_machine_port_warning.rb#L3-L39","documentation":"When the Docker provider runs containers inside a host VM or against a remote Docker machine (provider.host_vm? true, e.g. macOS/Windows without native Docker), forwarded ports bind on that host VM, not on your physical machine. With any forwarded_port network defined, this informational warning states the ports are reachable only via the remote/host-VM machine.","triggerScenarios":"Docker provider with a host VM or remote Docker host plus `config.vm.network \"forwarded_port\", guest: 80, host: 8080` in the Vagrantfile, during vagrant up; has_forwarded_ports? finds the network and the warn fires.","commonSituations":"macOS/Windows users with a boot2docker-style default VM; remote docker-machine style hosts; expecting localhost:8080 to serve the container.","solutions":["Reach the port on the host VM/remote machine (its IP), or tunnel to it: `vagrant ssh -- -L 8080:localhost:8080`","Add a private_network so the guest gets an IP you can contact directly","Install native Docker (Docker Desktop or engine) and drop the host VM so ports bind on your machine"],"exampleFix":"# before\nconfig.vm.network \"forwarded_port\", guest: 80, host: 8080  # binds on host VM only\n# after\nconfig.vm.network \"private_network\", ip: \"192.168.56.10\"  # reachable directly","handlingStrategy":"fallback","validationCode":"# Detect the situation before up: docker provider with a host VM\nvagrant config docker.host_vm 2>/dev/null || echo \"check provider.host_vm? in a trigger\"","typeGuard":"ports_bind_locally = ->(machine) { !machine.provider.host_vm? }","tryCatchPattern":null,"preventionTips":["Prefer private_network over forwarded_port with host-VM Docker setups","Install native Docker to make ports bind locally","Script an ssh tunnel (`vagrant ssh -- -L ...`) when you must reach a forwarded port"],"tags":["vagrant","docker","forwarded-port","host-vm","remote-host"],"backgroundTag":"remote-port-forward-limitation","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}