所以,我正在尝试学习Docker,并尝试创建一个简单的镜像来尝试它。Docker构建部分很顺利,但是当我运行Docker时,出现了问题:
(base) daniellombardi@Daniels-MacBook-Pro MyApp-test % docker run bd
/bin/sh: 1: python: not found
Dockerfile:
FROM ubuntu
RUN apt-get update && apt-get install -y python3 python3-pip
RUN pip3 install flask
RUN mkdir /MyApp-test
ADD folder /opt/MyApp-test
EXPOSE 5000
CMD python .main.py
如果有人想知道,这是main.py文件中的代码
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'IT WORKED! I AM RUNNING FROM A DOCKER CONTAINER!!!'
if __name__ == '__main__':
app.run(host="0.0.0.0", port=5000)
CMD python3 .main.py
- eyllanesc(base) daniellombardi@Daniels-MacBook-Pro MyApp-test % docker run 3bd python3: can't open file '.main.py': [Errno 2] No such file or directory
- LombardiD