News for hackers. Stuff that matters.

Ask HN: Docker for a Mac App?

Hi folks, I'm building a Mac utility to extract and process data from local PDF files. I use Python for crawling PDFs and Java for processing the data. I'd like to be able to share this program with other computers (mostly Macs and a couple with Windows) that don't have Python or Java installed. I've heard Docker might be a solution, but since I've never used it before, I'd like to ask you all if Docker is the right tool for this task or if there's a better one I should consider studying. In any case, it will be my first experience with containers. All hints are very welcome, and thanks!
( 15 comments | 3 points | on HN )
Re:Ask HN: Docker for a Mac App? by wmf on Wednesday November 15, 2023 @05:30PM (#38283529)
No, Docker is not right for this, mostly because Docker does not actually run on Mac; it runs on a Linux VM. MacOS doesn't really support containers.

I would suggest looking at Homebrew.

Re:Ask HN: Docker for a Mac App? by verdverm on Wednesday November 15, 2023 @06:02PM (#38283783)
containers on mac go through a VM

Many, many developers use Docker on Mac without issue

There is Docker Desktop and Colima you can use

Re:Ask HN: Docker for a Mac App? by wmf on Wednesday November 15, 2023 @06:34PM (#38283932)
There's two different things here.

Q: I need to run existing Docker containers on my Mac.

A: You have to use a VM; it's no big deal.

Q: What's the best way to package a new native Mac app?

A: Not containers.

Re:Ask HN: Docker for a Mac App? by gmzi on Wednesday November 15, 2023 @08:31PM (#38284871)
Thank you very much, wmf, for clarifying. I am doing some research to replace the Java dependencies with Python exclusively, so I can create a .dmg installer using PyInstaller or similar tool. This appears to be a more straightforward approach
Re:Ask HN: Docker for a Mac App? by seanthemon on Thursday November 16, 2023 @07:24AM (#38288689)
Take note, building .dmg or .exe of python apps may cause anti-viruses to panic when your users run the apps, they can add exceptions but I would recommend doing proper research into this.
Re:Ask HN: Docker for a Mac App? by solardev on Thursday November 16, 2023 @10:27AM (#38290718)
Docker on Mac creates Linux VMs though and this creates really slow file system abstractions for bigger folders.
Re:Ask HN: Docker for a Mac App? by verdverm on Wednesday November 15, 2023 @06:03PM (#38283792)
Are your users technical enough to run containers and install Docker Desktop / Colima?
Re:Ask HN: Docker for a Mac App? by gmzi on Wednesday November 15, 2023 @06:12PM (#38283820)
Thanks verdverm, my user's aren't technical at all, they can install a .dmg file in their macs, but nothing beyond that
Re:Ask HN: Docker for a Mac App? by speedgoose on Thursday November 16, 2023 @01:11AM (#38286281)
I don’t think you can use Docker for those users. I follow the Colima development from far by looking at their GitHub issues and releases and you don’t want to deal with such complexity with non technical users.
Re:Ask HN: Docker for a Mac App? by yuppie_scum on Wednesday November 15, 2023 @09:58PM (#38285418)
Python is cross-platform. Java is cross-platform.
Re:Ask HN: Docker for a Mac App? by solardev on Thursday November 16, 2023 @10:31AM (#38290772)
This sounds like a horribly bloated stack. Might it be possible to compile the Python part into a lib that the Java app can access? And then package the Java app as a distributable, maybe with a JRE bundled?
Re:Ask HN: Docker for a Mac App? by gmzi on Thursday November 16, 2023 @12:00PM (#38292045)
Thanks solardev, I've managed to get Java out of the stack replacing it with a Python package. Still horrible but not bloated anymore :). Now I'm looking for options to package a Python app, that seems to be way easier, so many new things for me here
Re:Ask HN: Docker for a Mac App? by solardev on Thursday November 16, 2023 @12:18PM (#38292359)
That's so much cleaner!

If your audience is developers (or similarly tech-savvy), that's probably enough to package it up as `brew install my_pdf_parser` for Macs (and Chocolatey for Windows) and have them take care of the Python deps.

If you're going for a mainstream desktop app though, that's a bit harder, but there's stuff like https://pyinstaller.org/en/stable/ (edit: as you already mentioned in another comment, lol)

Re:Ask HN: Docker for a Mac App? by runjake on Thursday November 16, 2023 @05:53PM (#38296812)
As other comments have mentioned, this isn't what Docker is for.

For Python, you'd use something like Py2App or whatever the current thing is. And Py2Exe for Windows.

https://py2app.readthedocs.io/en/latest/

https://pypi.org/project/py2exe/

PS: I typed your question into GPT 4 verbatim and it pointed me to PyInstaller, as well.

https://pyinstaller.org/en/stable/

Re:Ask HN: Docker for a Mac App? by gmzi on Friday November 17, 2023 @09:32AM (#38304123)
Thanks runjake for these resources, looking forward to dive into them as soon as I have script and dependencies ready to package