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

后端 未结 9 2855
名媛妹妹
名媛妹妹 2021-01-17 08:07

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 fil

相关标签:
9条回答
  • 2021-01-17 08:11

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

    It should be ENTRYPOINT ["java",

    0 讨论(0)
  • 2021-01-17 08:11

    In Google Cloud Platform in console project using nano the comand work for me
    1º-nano
    2-

    # The Dockerfile defines the image's environment
    # Import Python runtime and set up working directory
    FROM python:2.7-alpine
    WORKDIR /app
    ADD . /app
    
    # Install any necessary dependencies
    RUN pip install -r requirements.txt
    
    # Open port 80 for serving the webpage
    EXPOSE 80
    
    # Run app.py when the container launches
    CMD ["python", "app.py"]
    

    save the file...

    0 讨论(0)
  • 2021-01-17 08:15

    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.

    0 讨论(0)
  • 2021-01-17 08:15

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

    0 讨论(0)
  • 2021-01-17 08:15

    When doing it from Windows, I had to make sure that I have line breaks in my Dockerfile configured for Linux (LF) and not for Windows (CRLF) when editing it from a text editor.

    0 讨论(0)
  • 2021-01-17 08:19

    I experienced this issue when working on a React app setup on Docker.

    Sending build context to Docker daemon 1.143MB

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

    Here's how I solved it

    The issue was that I had another file named Dockerfile (capital case D) which had some instructions in it, and it was conflicting with the original dockerfile (lower case d) in my project root directory.

    I fixed this by deleting the Dockerfile and running the command:

    docker build t myapp:latest .
    

    to build the docker image from the dockerfile instead.

    That's all.

    I hope this helps

    0 讨论(0)
提交回复
热议问题