#!/usr/bin/env docker run

Dev tools

container build scripts

SHOW HN2024

496points
173comments
#66of 3,515 in 2024
Top 2%of 2024 by points

How HN took it

CuriousMostly questions and neutral comments

11 positive, 27 neutral or asking, 4 mixed, 12 critical, out of 54 comments about the project. Thread score -0.04.

Idea: 8 for, 4 againstDesign: 3 for, 3 againstExecution: 0 for, 4 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Clever, fun hack

    From 3 comments
    • This is genius and I love how this is a whole app meta-seed in a single file! I think I have docker trauma, why did we reach a point where we need computers inside our computers…
      bionhoward on HN
    • I had no idea a shebang could be used like this! After all of these years… Nice hack. Love it.
      WhackyIdeas on HN
    • Haha very clever. I like it. L
      renewiltord on HN

Objections

  • Not a true shebang; env with spaces is non-portable

    From 3 comments
    • The -S / --split-string option[1] of /usr/bin/env is a relatively recent addition to GNU Coreutils. It's available starting from GNU Coreutils 8.30[2], released on 2018-07-01.…
      noname120 on HN
    • Using spaces in a shebang is not a standard thing and doesn’t work in most shells.
      WhyNotHugo on HN
    • This isn't POSIX compliant is it? I feel like I tried to do something different but trying to put arguments in a shebang and ran into trouble there a year or two ago.
      Kab1r on HN
  • Better as a plain bash script that could be shellchecked

    From 1 comment
    • Cute trick, but it's not actually what the title claims. Since this is actually env calling bash first, not docker, this should just be a Bash script. You can still feed the…
      throwaway892238 on HN
  • Single-file packaging is unnecessary; directories work fine

    From 1 comment
    • This is cool hacking but I really don't get this obsession with "single file". Directories exist and can contain self-contained applications without the need to pack everything…
      kevincox on HN

Requests

  • Exec so Docker replaces the bash process

    From 1 comment
    • Can we figure out a way to throw an exec into the shebang so the Docker process replaces the bash One?
      keepamovin on HN

Questions

  • What is the practical use?

    From 1 comment

Alternatives named

  • nix-shell shebang

    From 1 comment
    • For an actually intentional, non-cursed version of this, see the nix-shell shebang [0]: > #! /usr/bin/env nix-shell > #! nix-shell -i python3 -p python3Packages.pillow…
      pedrovhb on HN
  • guix shell shebang

    From 1 comment
    • There's also `guix shell` which can be used in shebang position. Example from the Guix manual: ``` #!/usr/bin/env -S guix shell python python-numpy -- python3 import numpy…
      rekado on HN
  • podman-based self-building Dockerfile

    From 1 comment
    • I did this in Nov 2021 - https://www.grepular.com/Self_Building_and_Executing_Dockerfiles ``` #!/usr/bin/env -S bash -c "podman run --rm -w /x -v "\$PWD:/x" \$(podman build -q -…
      mike-cardwell on HN
  • bubblewrap

    From 1 comment
    • Something like this should definitely exist, just not with Docker! Podman is better but it's also a bit coupled to a distro - https://news.ycombinator.com/item?id=38981844 The…
      chubot on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/38987109)