Problem encountered on https://dotnet.microsoft.com/learn/web/aspnet-microservice-tutorial/docker-image
Operating System: windows
Getting this error: "Error response from daemon: Dockerfile parse error line 1: unknown instruction: ��F R O M" when attempting to run this command: "docker build -t microservice ."
@leecow who can help troubleshoot Docker problems? This one seems general - maybe corrupted Docker install?
@brennfoster I copy and pasted the Dockerfile into a hex editor and didn't see those characters in the beginning. What did you copy the sample dockerfile into? It's possible it left in a BOM or some other artifact when you copied the text. Can you upload your sample repo and link us to it?
To resolve your issue, I'd open the dockerfile into a text editor capable of showing it in hex (I use notepad++ with HexEditor plugin); and manually removing those non characters. The first hex addresses you should see are 46 52:
@karelz - the illegal characters snuck in during the OP's copy/paste when creating the Dockerfile. Clean those out and it should build fine.
OK, seems to be user error. Closing. Let us know if that is not the case.
Sorry for not getting back to this sooner.
I typed out the content found here: https://dotnet.microsoft.com/learn/web/aspnet-microservice-tutorial/docker-file into the dockerfile and I'm still getting this error. I did this using VS Code and again using Notepad++. I shouldn't have inserted any illegal characters doing this.
You're definitely getting a byte-order mark being put into that file. You need to check the encoding of the file in Notepad++ and make sure "Encode in UTF-8 with BOM" is not selected. I would change the encoding of the file to "ANSI" and try again. I copied the same code and typed it in manually and did not get a byte-order mark, so it's likely to be a setting on your PC that's doing this (I have no knowledge of what such a setting would be).
Okay, switching encoding to "ANSI" worked. Thank you!
You're definitely getting a byte-order mark being put into that file. You need to check the encoding of the file in Notepad++ and make sure "Encode in UTF-8 with BOM" is not selected. I would change the encoding of the file to "ANSI" and try again. I copied the same code and typed it in manually and did not get a byte-order mark, so it's likely to be a setting on your PC that's doing this (I have no knowledge of what such a setting would be).
Thanks @gortok changing encoding in notepad++ to ANSI worked for me.
Problem encountered on https://dotnet.microsoft.com/learn/web/aspnet-microservice-tutorial/docker-image
Operating System: windowsGetting this error: "Error response from daemon: Dockerfile parse error line 1: unknown instruction: ��F R O M" when attempting to run this command: "docker build -t microservice ."
perfect its working now
Most helpful comment
You're definitely getting a byte-order mark being put into that file. You need to check the encoding of the file in Notepad++ and make sure "Encode in UTF-8 with BOM" is not selected. I would change the encoding of the file to "ANSI" and try again. I copied the same code and typed it in manually and did not get a byte-order mark, so it's likely to be a setting on your PC that's doing this (I have no knowledge of what such a setting would be).