I'm working on a windows 11 pc with a wsl2/ubuntu machine. My pc have an ip of 192.168.0.19
I installed vagrant inside my ubuntu machine.
I installed docker desktop and virtualbox on my pc.
With docker I started a simple nginx container.
version: '3.9'
services:
nginx:
image: nginx:latest
container_name: nginx
restart: unless-stopped
ports:
- 8090:80
environment:
- TZ=Europe/Brussels
volumes:
- ./data:/usr/share/nginx/html:ro
networks:
- proxy
networks:
proxy:
name: proxy_network
external: true
For vagrant I'm using that Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/jammy64" # default username/password : vagrant
config.vm.synced_folder ".", "/vagrant", disabled: true # disable shared folder
config.vm.boot_timeout = 600
config.vm.network "public_network", ip: "192.168.0.250", bridge: "Realtek PCIe GbE Family Controller"
config.vm.hostname = "dev01"
config.vm.provider :virtualbox do |virtualbox|
virtualbox.memory = 2048
virtualbox.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ] # failed to create the raw output file /dev/null (VERR_PATH_NOT_FOUND)
virtualbox.customize [ "modifyvm", :id, "--uart1", "off" ] # slow to start
virtualbox.customize [ "modifyvm", :id, "--graphicscontroller", "vmsvga"]
end
config.trigger.after :up do |trigger|
trigger.run = {path: "./ssh-key.sh", args: "add"}
end
config.trigger.after :destroy do |trigger|
trigger.run = {path: "./ssh-key.sh", args: "remove"}
end
end
In wsl (outside of the vagrant machine) I can do a curl localhost:8090 (and I receive the nginx response) but not curl 192.168.0.19:8090. I don't know why.
After a vagrant up I can do a ssh [email protected]. Inside of that machine I can do a ping 192.168.0.19 but not a curl 192.168.0.19:8090. I can also do a curl www.google.com Why ? And how to resolve that ?
I also tried to create a vm directly from virtualbox ui with the same properties and .... everything works inside that machine.
I don't understand the origin of the problem.