The docker guidance says you can run docker build piping the dockerfile:

#On linux
$ docker build - < Dockerfile

and on Windows it says to do this:

#PowerShell
Get-Content Dockerfile | docker build -

Nice. But I’ve been getting this error all day…

> Get-Content Dockerfile | docker build -
unable to prepare context: failed to peek context header from STDIN: Incorrect function.

WAT

After much pain, I figured out the error is because I was running inside conemu. *Sigh*

Sorry to say I don’t know how to fix the problem. But at least I know the cause. The solution for now is to run this command in a Regular PowerShell window and avoid conemu for this command.

Since I searched this error in google and found nothing, I hope this helps the next person who looks.