2

How to open GUI applications in multipass container(guest = ubuntu, host = ubuntu)?

I have installed multipass container, which is kind of docker container to run logically separate system. Multipass provides the facility of ssh(terminal access) but I am figuring can I also run applications with GUI interface?

2

It took me some time to find out how to exactly forward the GUI applications from multipass machines to host, but it turned out to be simple...

First, we need to 'ssh' to our guest machine. Multipass offers the 'shell' command, which is also a wrapper around ssh. Since we are required to turn X forwarding on, we will use the original 'ssh' command instead.

Since, ssh requires public key, we first need to get those keys and save it to our home repository. The ssh keys are saved in '/var/snap/multipass/common/data/multipassd/ssh-keys'. It turned out that multipass uses same key for all the container initiated, so, we just need to perform this once.

mkdir ~/.ssh/multipassKey

sudo cp /var/snap/multipass/common/data/multipassd/ssh-keys/id_rsa ~/.ssh/multipassKey/id_rsa

Add the key to your grp( replace user with your user name)

sudo chown user -R .

Start the container with the 'name' (replace it with the actual name)

multipass start name

Find the ip of the running container

multipass ls

Now, ssh into the machine with ip 1.1.1.1 ( replace with ip found above)

ssh -X -i ~/.ssh/multipassKey/id_rsa ubuntu@1.1.1.1

Now, all the GUI applications will be forwarded over ssh to the host machine

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.