from Hacker News

docker2exe: Convert a Docker image to an executable

by alexmolas on 5/5/25, 8:47 PM with 90 comments

  • by Epskampie on 5/7/25, 4:50 AM

    > Requirements on the executing device: Docker is required.
  • by dennydai on 5/7/25, 5:51 AM

    Just use shebang

    https://news.ycombinator.com/item?id=38987109

    #!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"

  • by rullopat on 5/7/25, 8:15 AM

    It's great for sending your 6 GB hello world exe to your friends I suppose
  • by cik on 5/7/25, 5:06 AM

    It sounds like docker export and makeself combined. We already ship to select customers prebuilt containers exactly this way.
  • by aussieguy1234 on 5/7/25, 6:19 AM

    On Linux, there would be little to no performance penalty to something like this since Docker is just fancy chroot, re using the same kernel as the host.

    But not on other platforms. They are the same but run Linux in a VM.

  • by ransom1538 on 5/7/25, 10:47 AM

    Ah finally. We have finished where we started.
  • by kkapelon on 5/7/25, 5:57 AM

    This is just a simpler wrapper over the docker executable that you need to have installed anyway.
  • by rietta on 5/7/25, 12:05 PM

    I remember thinking that the Visual Basic runtime was unacceptable bloat overhead and now this. Cool work though. Also reminds me of self extracting WinZip files.
  • by hda111 on 5/7/25, 8:58 AM

    Why? Would be easier to embed both podman and the image in one executable to create a self-contained file. No docker needed.
  • by nine_k on 5/7/25, 3:44 PM

    Tired: docker run.

    Wired: docker2exe.

    Inspired: AppImage.

    (I'll show myself out.)

  • by arjav0703 on 5/7/25, 5:22 AM

    This is useful if you want to share your container (probably something that is prod ready) to someone who knows nothing about docker. An usecase would be, you built a custom software for someone's business/usecase and they are the only one using that particular container.
  • by fifilura on 5/7/25, 12:11 PM

    Docker is mostly backend, but I wonder how far we are from universally executable native applications?

    I.e. download this linux/mac/windows application to your windows/linux/mac computer.

    Double-click to run.

    Seems like all bits and pieces are already there, just need to put them together.

  • by isaacimagine on 5/7/25, 10:15 AM

  • by PicassoCTs on 5/7/25, 9:04 AM

    So, does this work with a dockerswarm? As in a whole services swarm- get converted down into a monolith?
  • by sunrunner on 5/7/25, 8:00 AM

    I'm just as disappointed as I was when I first heard about being able to create 'Self-contained Executable Programs with Deno Compile', perhaps slightly more even as at least that bundled the interpreter.

    In all seriousness, Docker as a requirement for end-users to create an executable seems like a 'shift-right' approach to deployment effort, as in, instead of doing the work to make a usable standalone executable, a bunch of requirements for users are just pushed on to them. In some cases your users might be technical, but even then Docker only seems to makes sense when its kept inside an environment where the assumption of a container runtime is there.

    I assume extra steps are needed to allow the 'executable' to access filesystem resources, making it sandboxed but not in a way that's helpful for end users?

  • by Alex_001 on 5/7/25, 8:26 AM

    This is super cool — especially for sharing tools with non-technical users or bundling CLIs without asking people to install Docker. Packaging infra-heavy apps into a simple .exe could really smooth out distribution. Curious how it handles startup time and embedded filesystem size.
  • by revskill on 5/7/25, 5:10 AM

    So baiscally i could bundle the linux os as an exe and run in windows.