本文介绍了来自守护程序的错误响应:Dockerfile解析错误行1:未知指令:#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是docker的新手,正在尝试学习它。
我正在按照本教程进行操作:
Im new to docker and trying to learn it.Im following this tutorial: https://docs.docker.com/get-started/part2/#apppy
所以我在Windows上安装了Docker。
创建了3个文件,app.py,Dockefile和Requirements.txt
So I installed Docker on Windows.Created 3 files, app.py, Dockefile and requirements.txt
我的docker文件如下
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"]
当我在powershell中运行
When I run it in powershell
docker build -t friendlybuild .
但是结果是:
Error response from daemon: Dockerfile parse error line 1: unknown instruction: #
就像它不起作用
我不知道为什么它不起作用
I have no idea why it doesnt work
推荐答案
通过删除dockerfile并使用记事本(而不是可视代码)创建它来解决
Solved by removing the dockerfile and creating it with Notepad instead of Visual Code
这篇关于来自守护程序的错误响应:Dockerfile解析错误行1:未知指令:#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!