Cute trick, but it's not actually what the title claims.<p>Since this is actually <i>env</i> calling <i>bash</i> first, not docker, this should just be a Bash script. You can still feed the Dockerfile to <i>docker build</i> via STDIN. But you'd gain the ability to shellcheck the Bash, the code would be easier to read, write, maintain, add comments to, etc. You could keep the filename the same, run it the same way, etc. The way they've done it here is just unnecessarily difficult.