Accessing Host machine urls from Ubuntu VM - windows

I have an Ubuntu VM on my windows host machine. I have installed Hashicorp consul on my windows host machine. I am trying to run docker container and trying to access the consul url from the VM using ip. But I am unable to do so.
Is there a way where I can access any host machine url from the ubuntu virtual machine. I am not able to access any url of app deployed on host machine from vm.

Related

Obtain Docker host address WITHOUT 'Docker Desktop for Windows'

I have docker installed on Windows Server and need to access something running on the host machine. The containers are Windows containers.
All other answers I can find which state host.docker.internal, docker.for.win.localhost or docker.for.win.host.internal do not work as you cannot have 'Docker Desktop' installed on a Windows Server machine (these names do not resolve).
This is confirmed by the official Docker docs:
The host has a changing IP address (or none if you have no network
access). We recommend that you connect to the special DNS name
host.docker.internal which resolves to the internal IP address used by
the host. This is for development purpose and will not work in a
production environment outside of Docker Desktop for Windows.
So what's the alternative?

Can't access my flask app running on my virtual machine

I'm running a Ubuntu 18.10 LTS virtual box on my Windows 10 system.
In the network configuration I set the network to bridge.
After that my virtual machine appears in my local network with the ip 192.168.0.231.
A ping from my hosting system to the VM works fine.
I'm then starting a flask app with DEBUG=TRUE, TEST=TRUE, SERVER_NAME=127.0.0.1:5001. On the VM the server starts and is available under localhost:5001.
But from my hosting service I get Could not get any response, when I try to access 192.168.0.231:5001.
Do I have to open some ports on the VM?
Thanks!
You need to:
Start the VM with the port forwarded and be sure it is not used on your Host OS
use when starting the app --host=0.0.0.0 if you start it with flask run

How to access a web application running as a container in ubuntu from my windows system

I am running a web application(copied from github examples) that is running as a container in a remote ubuntu VM. The application is a Node JS application that is using mysql database. I brought the application up using docker-compose in ubuntu.
The application came up as http://172....:3000 using a network port. The ip address is displayed in the docker-compose terminal. In the ubuntu system, when i do curl http://172....:3000, it gives a proper success response. The ip address is a container network address. It is not the VM's ip address. There is no firewall.
How to access the web application from my windows 7 machine. When I tried accessing using http://VM Ip address:3000, it is not hitting ubuntu system. I am not getting any message in the docker-compose terminal. Can anyone help here ?
ports:
- "3031:3000"
similar line in your docker compose means you have published port 3000 of your container to port 3031 of your Ubuntu VM.
now you can access your client service as http://<ubuntu-ip>:3031 but before this, you need to allow access to port 3031

How to call a container, running on a virtual machine, from a Windows browser?

I have Windows 7 operating system and have set up Docker. Docker starts on the virtual machine. I create some containers on Docker and test them on the command line, for example:
curl localhost:9200
Now I want to test this container from a Windows browser
http://localhost:9200
How do I call the container, which is running on a virtual machine, from a Windows browser?
Assuming you have 'published' the service to port 9200, just use the IP address of the VM instead of localhost. To get that address, you can inspect your VM setup, or use the boot2docker command:
boot2docker ip
Then, insert that address where I have the 'x's here in your browser:
http://x.x.x.x:9200
Or map published IP address from docker container running inside boot2docker like this:
boot2docker ssh -L 0.0.0.0:9200:localhost:9200
That way, you (and others that can access your computer) can acccess it on both of the following links:
http://localhost:9200
http://<host_machine_ip>:9200

How to create an SSH tunnel between Ubuntu Server (Virtual Machine) and Mac OS 10.8.5

I want to create an SSH tunnel between my virtual machine (Ubuntu server 12.04) and my MAC OS, the main thing is i want to access to the Ubuntu server from an external machine without
i have the IP address for the Ubuntu Server : 192.168.248.132
and the IP address of the MAC os : 172.20.3.90
I can access form the mac os to the Ubuntu server, but i want to access to the ubuntu server from an external machine.
Which VM you using?
You should create Network interface called Bridged Network - for VM Ware.
This way your Ubuntu will get real IP from local DHCP server - router in your case.
So IP become 172.20.XX.XX.
This should be enough to be accessed from local network.

Resources