Live data from Hacker News

Show HN: dockerc – Docker image to static executable "compiler"

github.com

121–130 of 150 posts

Re: Show HN: dockerc – Docker image to static executable "compiler"

#122
post #21

The README indicates that this tool will only support Windows and MacOS through emulation. I find that odd. Let's face it, if you're using Linux, you're comfortable typing some stuff into the terminal to install software. Or if you aren't comfortable with it yet, you will be soon. That's just the reality of using Linux. Even ignoring that, snap and flatpak apps provide a generally awful user experience, and I fail to…

> It would make sense that a tool like this would prioritize MacOS/Windows support above all else. Yep, unfortunately I've not had the time to make it work well on those platforms. I got an initial demo working on MacOS but I'm currently facing the issue that I'm unable to statically compile QEMU on MacOS. I've also started writing a VirtualizationFramework[0] based backend. > Why would QEMU even necessary? Docker ru…

I'm aware of the WSL dependency for the Windows version of Docker - I dealt with it 5 days a week for 4 years before I switched to Ubuntu as my work OS this January. When I said "Docker runs fine on Windows," I meant that Microsoft already ships the necessary runtime to host a Docker container.

I can't comment on MacOS as I haven't used it regularly in several years, and even then I only used Docker briefly on MacOS.

I can see how this approach would result in reliably cross-platform applications, but it immediately raises a couple of concerns: binary size, and interoperability with the underlying OS.

Docker on its own can already be very large. Shoving it inside of QEMU adds even more largeness. Are binary sizes a priority at all? If so, how do you plan to keep them reasonably compact?

I'll assume that user-facing software is the main target for this tool, which means that GUI support is really important. By hosting an application inside of QEMU and Docker, you create a very long and complicated path that stuff must travel through in order for a dockerc'd GUI application to interact with other programs. It's pretty easy to plumb an X server into WSL, but there are limitations when you get into more nuanced interactions with the rest of the machine (ex: clicking and dragging files into the window). Docker adds yet another layer that could cause trouble.

I wish you luck. I tried to make a similar tool for a game engine a while back, and it was absolutely hellish.

Re: Show HN: dockerc – Docker image to static executable "compiler"

#123

Earlier quoted context omitted.

You should also be able to do that with Cosmopolitan/APE.

Would you be able to expand on this, my impression is that these tools build a custom c program instead? Thanks

They provide a compiler and bundled userland that can be used to compile many C programs (even, for example, a slightly patched CPython) for a multi-OS binary distribution. Ruby shouldn't be that different.

Re: Show HN: dockerc – Docker image to static executable "compiler"

#124
post #104
post #103

I absolutely love how we are going full circle to portable executable binaries but with embedded OS. Taking the whole "it works on my machine" to a whole new level of troubleshooting hell. Awesome project though.

Every decent application should be a portable executable binary!

— UEFI authors

Re: Show HN: dockerc – Docker image to static executable "compiler"

#125

Earlier quoted context omitted.

Im surprised no one mentioned that the program the unstable ranter wants is essentually a social media stalker app to find people on all social media sites. Perhaps some barriers to use are good sometimes.

If they don't want people to find their social media profiles, then they shouldn't have social media profiles.

I know, she was asking for it right?

Nice victim blame.

Re: Show HN: dockerc – Docker image to static executable "compiler"

#126

What about Cosmopolitan and WASM? ;) Cosmopolitan libc allows compiling of a single binary that runs on multiple OS platforms without modification – maybe Dockerc could use this to create a more universally portable container binary? WASM binaries could run in the browser, or another WASM VM, including securely sandboxed environments that spin up fast. I understand that newer Docker builds can use WASM under the hood…

Unfortunately cosmopolitan wouldn't work for dockerc. Cosmopolitan works as long as you only use it but container runtimes require additional features. Also containers contain arbitrary executables so not sure how that would work either... As for WASM, this is already possible using container2wasm[0] and wasmer[1]'s ability to generate static binaries. [0]: https://github.com/ktock/container2wasm [1]: https://wasmer.…

As someone who's not overly familiar with Docker, how big are these executables in the end?

Edit: This was already answered here https://news.ycombinator.com/item?id=39622184

Re: Show HN: dockerc – Docker image to static executable "compiler"

#127
post #109
post #77

This is really great. I have been trying to get my docker to be more distributable. Right now it's just a simple python script in a python env inside a docker container inside a QEMU container to automate a click and then netcat something. Pretty sweet. It's only like 20GB, so pretty lightweight by modern standards.

You jest, but python is the poster child for, works on my machine.

Unless you're on Windows 11. You open the console, type "python", for some reason the Windows App Store launches and goes to a "python app". You think to yourself you should probably install Python from the source, so you go to pythons website and download and run the installer, you select "add to path", you run it and it STILL goes to the Windows App Store. So at this point you Google It. You find that you need to use the Windows search bar to find "Manage app execution aliases" and unselect the aliases using python. You then try calling "python" again in CMD, and its not found. You open user environment variables GUI, and find that the PATH was not modified. You again Google "where is python installed" and then you manually append that to PATH and it works. This is the wonderful experience of installing Python in Windows.

Re: Show HN: dockerc – Docker image to static executable "compiler"

#128
In the past I've used and recommended nix-bundle¹ or its first-party counterpart `nix bundle`² for this. That lets you skip the step of managing the creation of the Docker image, which is nice.

I suppose dockerc could be convenient when you already have a Docker image on hand, especially if it was a PITA to create or its creation is a lost art.

Besides fat executables, `nix bundle` also lets you create Docker images, AppImages, and images/executables in a few other formats.

--

1: https://github.com/matthewbauer/nix-bundle

2: https://nixos.org/manual/nix/unstable/command-ref/new-cli/ni...

Re: Show HN: dockerc – Docker image to static executable "compiler"

#129
post #109

Earlier quoted context omitted.

You jest, but python is the poster child for, works on my machine.

Unless you're on Windows 11. You open the console, type "python", for some reason the Windows App Store launches and goes to a "python app". You think to yourself you should probably install Python from the source, so you go to pythons website and download and run the installer, you select "add to path", you run it and it STILL goes to the Windows App Store. So at this point you Google It. You find that you need to u…

Or the PATH was updated, but you forgot that you need to restart your command prompt to refresh the environment variables...

Re: Show HN: dockerc – Docker image to static executable "compiler"

#130
post #17

Folks will literally shove a container runtime, FUSE, and operating system image into a binary to avoid going to thera... learning Nix.

But Nix is the best way to build images for dockerc.

Nix can generate fat binaries for you all by itself; you can just skip dockerc. It's a one-liner:

    # nix bundle nixpkgs#hello
    # ./hello
    Hello, world!

https://news.ycombinator.com/item?id=39632011
Post reply on HN