Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] MacOS host support #36

Open
dcorbe opened this issue Dec 20, 2021 · 49 comments
Open

[Feature] MacOS host support #36

dcorbe opened this issue Dec 20, 2021 · 49 comments

Comments

@dcorbe
Copy link

dcorbe commented Dec 20, 2021

Is this an effort worth exploring?

@89luca89
Copy link
Owner

Yea I would like in the future to support it, what blocks me for now is the host integration

On MacOS podman runs in a VM, and distrobox integrates with the container's host, which in this case will be the VM, not the MacOS host
So it becomes quite a limited experience, without exports of stuff or graphical apps integration

I'm gonna keep this issue for the future and mark it ad blocked until we either find a solution or we create a piece of documentation that explains the situation and does not confuse the users

Ironically I think (not tried yet) that distrobox on WSL2 could retain some real host integration seeing how the linux VM is tightly integrated with the Windows host 🤷

@89luca89 89luca89 added blocked help wanted Extra attention is needed host-distro labels Dec 20, 2021
@89luca89 89luca89 changed the title Mac OS as a host OS? 🙃 [Feature] MacOS host support Dec 20, 2021
@DanielTolentino

This comment has been minimized.

@89luca89
Copy link
Owner

89luca89 commented Dec 20, 2021

Yea as said I didn't try 😂
Anyway that seems an incompatibility between wsl2 and podman probably? Maybe there are some guides for it
Distrobox works with docker too I think that shouldn't have problems

Anyway I'd stick this conversation to macos and in case there is interest open a new one for WSL2
(I doubt WSL1 will work)

@goodevilgenius
Copy link

I just discovered distrobox, and this was the first thought I had. I have to use a Mac for work, but would love to be able to use this for a bunch of stuff.

Although podman might be difficult, maybe docker would work better, due to it's somewhat better integration into the host with HyperKit (hypervisor).

I'm not really sure of the specifics of how that works, but it might be a consideration.

@dcorbe
Copy link
Author

dcorbe commented Dec 29, 2021 via email

@89luca89
Copy link
Owner

All of them share the VM problem anyway, podman docker k3s, minikube all work inside a linux VM
I think it would be doable as a way to have something to have pet containers for dev environments, but I see it difficult to have the level of integration that can be achieved on a Linux host

@89luca89 89luca89 removed the help wanted Extra attention is needed label Jan 15, 2022
@89luca89
Copy link
Owner

89luca89 commented Feb 4, 2022

Let's follow this as it's a blocker for now: containers/podman#8016

@WoMspace
Copy link

WoMspace commented Aug 2, 2022

My two cents are that I'd love to have distrobox on macOS regardless of the lack of integration, as an easy way to automatically spin up lightweight VMs for various uses.
I love WSL on windows and just installed distrobox on a linux machine and it's amazing there too, would love to have some analogue on macOS

@89luca89
Copy link
Owner

89luca89 commented Aug 8, 2022

Well the point of toolbox/distrobox type of software is the tight integration with the host
If I cannot provide this integration it's just like using podman/docker

On MacOS right now I'm not even sure graphical apps can work inside distrobox with podman-machine

@kevindurb
Copy link

While i totally agree that tight integration with the host is what makes distrobox amazing i think there is some amount of usage for macos... I wanted to work on my personal distrobox container today and didnt have my linux machine near by and ended up doing podman build... and podman run... to be able to mess with it a little... but the problem is i still didnt have my user setup correctly as distrobox automagically does for me... but i also would rather not add a massive amount of bloat to this project just to support a weird usecase... this project is so fantastic already id hate to taint it with an extra chunk of bloat to have to maintain...

@jakenvac
Copy link

jakenvac commented Oct 25, 2022

It might be worth investigating colima and/or lima for macos support rather than podman as it offers tighter integration with the OS out of the box. (Still a vm however)

@89luca89
Copy link
Owner

@jakeHL will investigate, I don't have a Mac so it might take some time 😄

@jakenvac
Copy link

jakenvac commented Oct 26, 2022

I daily drive an m1 macbook, Let me know if I can be of help. I'll take a look in the meantime. Would love to see this up and running

@jacobnollette
Copy link

This would be increadible - mac os is the only option at work

@stevo-knievo
Copy link

1+

@aral
Copy link

aral commented Dec 23, 2022

Let's follow this as it's a blocker for now: containers/podman#8016

Heads up, looks like that blocker is now closed on the podman side of things: containers/podman#8016 :)

@jakenvac
Copy link

I think podman honestly just over complicates things. Lima should be perfect for something like this - it allows for invoking commands inside a VM, sharing state between host and VM etc. Honestly its not far from doing what distrobox already does. Ive started to play with it to create a distrobox like experience and its been pretty great. Ive not tried integrating actual distrobox yet though.

@aral
Copy link

aral commented Dec 25, 2022

@jakeHL Hey Jake, is your work available somewhere to play with? Sounds very useful :)

@jakenvac
Copy link

Its not, its just crappy shell aliases and functions to try and recreate the behavior. If I can get some time over the holiday break I'll tidy it up and push it.

@kevindurb
Copy link

kevindurb commented Jan 4, 2023

ok so i started messing with getting distrobox installed on macos, the install script uses install which is a different version from what is on macos so i did brew install coreutils and then replaced install with ginstall to get all the distrobox scripts put into place, that worked... So that would need to change in some way for mac compat

Next problem is when i go to run distrobox create I get this:

Error: failed to connect: dial tcp [::1]:51787: connect: connection refused

An error occurred

An error occurred

@kevindurb
Copy link

kevindurb commented Jan 4, 2023

lol that error was because I didnt have my podman machine running 🤦🏻‍♂️... more errors on create using podman Error: statfs /Users/kevindurbin/.local/bin/distrobox-export: no such file or directory... testing docker...

@kevindurb
Copy link

container stays stuck in CREATED... I think its due to performance of mounting all of ~ with macos docker...

@89luca89
Copy link
Owner

lol that error was because I didnt have my podman machine running 🤦🏻‍♂️... more errors on create using podman Error: statfs /Users/kevindurbin/.local/bin/distrobox-export: no such file or directory... testing docker...

Yes, this is because some parts of distrobox (init, host-exec, export) are mounted inside the container itself
In case of lima and other VM based solutions (which includes docker), the path of distrobox is not present, nor the same as inside the VM
So this will create errors

@kevindurb
Copy link

Podman on macos is also a VM based solution. I dont know of any container system that doesnt run on a vm on macos.

@kevindurb
Copy link

yea it seems like theres something macos doesnt like about rslave mounts... i have no clue what an rslave mount is so gonna do some research to see what this does and maybe theres an alternative for macos

@kevindurb
Copy link

kevindurb commented Feb 7, 2023

https://docs.docker.com/storage/bind-mounts/#configure-bind-propagation

Mount propagation doesn’t work with Docker Desktop.

Well theres that answer lol

@kevindurb
Copy link

ok so i was able to enter the container 🎉
I removed the following mounts: /, /dev, /sys, /tmp and changed the user home mount to not have rslave bind propagation, when i ran distrobox enter the first time it said Starting container... then exited silently. I ran it a second time and it dropped me into my container! So maybe with macos we could have a limited functionality mode or maybe something like lima can do bind propagation?

@kevindurb
Copy link

overall that means that if you remove some mounts and change the home mount to be a "regular" (shared?) mount and change the installer to use ginstall then you can have a limited functionality working distrobox on macos 🎉

@kevindurb
Copy link

PR to get the installer working for macos #615

@kevindurb
Copy link

Updated my pr to also add the changes to get create working. With those changes distrobox now works on macos in a more limited capacity (no /dev for device support, etc)

@89luca89
Copy link
Owner

I'm glad there is progress in this issue, thanks @kevindurb 😄
Hopefully I'll find a way to run macos in vm (laptop/cloud) and do some help 👍

@pythoninthegrass
Copy link

pythoninthegrass commented Mar 2, 2023

Lost my original draft Ugh! Clearly need more coffee, but I might be able to get you a 2017 x86 MacBook Air from work @89luca89.

Or I can test whatever you want on either a runner or locally — have access to a number of x86 and arm64 Macs.

@FedX-sudo
Copy link
Contributor

Potentially stupid question: How feasible is it to add MacOS support using something like Docker-OSX?

@Soromeister
Copy link

Any updates on this?

@osalbahr
Copy link
Contributor

I daily drive an m1 macbook, Let me know if I can be of help. I'll take a look in the meantime. Would love to see this up and running

Same here, except I daily drive an Intel-based MacBook. Would love to help port distrobox to macOS, let me know if there is anything I should try. I’d like to have a distrobox with development tools in the same seamless way. I don’t know if being able to export is a main feature.

@osalbahr
Copy link
Contributor

I created Homebrew/discussions#4603 and hopefully getting a fully functional brew install distrobox on Linux would make porting to macOS easier

nixith added a commit to nixith/nixpkgs that referenced this issue Jul 7, 2023
Distrobox is currently marked as compatible for Darwin systems. However, upstream currently contains an [unresolved issue](89luca89/distrobox#36) static macOS as currently unsupported, and attempts to run distrobox fail.
github-actions bot pushed a commit to NixOS/nixpkgs that referenced this issue Jul 8, 2023
Distrobox is currently marked as compatible for Darwin systems. However, upstream currently contains an [unresolved issue](89luca89/distrobox#36) static macOS as currently unsupported, and attempts to run distrobox fail.

(cherry picked from commit eeb7345)
@redthing1
Copy link

I'm very interested in this too

@tl87
Copy link

tl87 commented Dec 21, 2023

I would also really like for this to be a reality 👍🏻

@kevindurb
Copy link

just fyi for those that want this ive just tested running distrobox in lima and i think thats the solution here. No matter what way you run containers on macos they run in a vm (docker, nerdctl+lima, podman, etc) so the easiest way to run distrobox on macos is:

limactl start
lima sudo apt install distrobox
lima distrobox create
lima distrobox enter ...

and then you're in a distrobox "on" macos (technically distrobox on ubuntu vm on macos), tested on apple silicon. The one oddity ive found is sometimes i need to distrobox enter twice cause for some reason i havent investigated the first fails silently. Also by default lima mounts the host's home dir to /Users/[username] inside the vm so its not the home dir as the user in the vm. but thats a simple config change

@kevindurb
Copy link

If anything it might be cool to add a lima.yaml to this repo that does the mount and installs distrobox automatically

@Sahil-Gulihar
Copy link

Has it been resolved?

@osalbahr
Copy link
Contributor

osalbahr commented Sep 7, 2024

Has it been resolved?

As of now, Homebrew lists distrobox as Linux-only, so I guess not.

This was also confirmed in March, 2024, in a Homebrew discussion: https://github.com/orgs/Homebrew/discussions/5190 (at least on M1, no official support for distrobox on macOS). To be clear, this is not Homebrew's issue to fix, it's just an easy status check.

@Sahil-Gulihar This issue remains open if you would like to work on it. You'll probably have to do some form of a limited-features, container-in-container solution, which I don't know the use case for that compared to directly using containers (what I personally ended up doing, it's a good-enough workaround for my use).

(I'm no longer interested in actively working on it, but would be happy to try to help if you run into an issue)

@redthing1
Copy link

To anyone who's interested in this: I wanted something like distrobox for a long time, after switching to a mac.
So I wrote my own minimalist implementation of something like distrobox. You define your linux box environment using a dockerfile (samples provided), then you can seamlessly mount your home/user directories in, so you can work on them directly but from a linux terminal.

Specifically designed and tested on mac but also will work anywhere supporting docker/podman. If you want to use docker instead of podman just Ctrl+F replace, it works with both.

I hope this is useful to others who switched to mac and miss distrobox!

https://github.com/redthing1/mim

@Sahil-Gulihar
Copy link

Specifically designed and tested on mac

Does it solve the issue of accessing GUI apps from host system to the docker/podman?

@redthing1
Copy link

redthing1 commented Sep 13, 2024

Specifically designed and tested on mac

Does it solve the issue of accessing GUI apps from host system to the docker/podman?

You can X11 forward, its quite straightforward. Here's a guide: https://gist.github.com/sorny/969fe55d85c9b0035b0109a31cbcb088

@ericcurtin
Copy link
Contributor

ericcurtin commented Oct 20, 2024

FWIW I did manually get this working using

podman machine

and

podman run -e DISPLAY=some-ip-address:0 container-image

and

xquartz

using this guide for the xquartz bits:

https://gist.github.com/sorny/969fe55d85c9b0035b0109a31cbcb088

so it's possible at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests