Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error response from daemon: Dockerfile parse error line 1: unknown instruction: #

Tags:

docker

Im new to docker and trying to learn it. Im following this tutorial: https://docs.docker.com/get-started/part2/#apppy

So I installed Docker on Windows. Created 3 files, app.py, Dockefile and requirements.txt

My docker file looks like this

# Use an official Python runtime as a parent image
FROM python:2.7-slim

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
ADD . /app

# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt

# Make port 80 available to the world outside this container
EXPOSE 80

# Define environment variable
ENV NAME World
CMD ["python", "app.py"]

When I run it in powershell

docker build -t friendlybuild .

But as result it gives this:

Error response from daemon: Dockerfile parse error line 1: unknown instruction: #

Like it doesnt work

I have no idea why it doesnt work

like image 482
Sharpless512 Avatar asked Mar 03 '18 20:03

Sharpless512


3 Answers

I forgot to have a whitespace in ENTRYPOINT["java",

It should be ENTRYPOINT ["java",

like image 92
Jöcker Avatar answered Nov 02 '22 11:11

Jöcker


I just tested the same and by default VSCode seems to save the Dockerfile with UTF-16 LE encoding.

Resaving the file as UTF-8 allowed docker build to run without error.

like image 29
mjdendura Avatar answered Nov 02 '22 09:11

mjdendura


Solved by removing the dockerfile and creating it with Notepad instead of Visual Code

like image 16
Sharpless512 Avatar answered Nov 02 '22 09:11

Sharpless512