Score:0

How do I connect from my multipass guest OS to my host OS's localhost

cn flag

I have two websites running locally on my system which need to access each other. One is within a multipass vm, and the other is in docker and accessible via localhost in my host OS.

In the site in the vm, I need to give a URL for it to access the other site. How do I find or set up a url I can use to connect from my virtual machine to my host OS?

For example, in my VM curl <some url> should return the contents of http://localhost on my host OS.

user535733 avatar
cn flag
One of the security features of virtualization is that Guests cannot easily access resources on the Host through localhost...that would be a big security hole, since malware on the Guest could access the Host. Guests CAN access Host resources through the host's services that are bound to the host IP address (like other clients on the network). This gives you two choices: Either change your Docker container so it's accessible fro other machines (not localhost), or edit your virtualization backend application settings to permit localhost access.
Neil Haskins avatar
cn flag
Yes, I suppose my question is how do I edit my virtualization backend application settings to permit localhost access?
user535733 avatar
cn flag
Multipass is the *front*end, using whatever your Host OS provides for a *back*end. What is your Host OS?
Neil Haskins avatar
cn flag
Host OS is Ubuntu 20.04. (So is guest.) I'm using the default Qemu driver, if that's relevant.
user535733 avatar
cn flag
Then see https://stackoverflow.com/questions/67520919/how-can-i-share-the-localhost-of-my-host-computer-with-a-qemu-image
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.