Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Lonie Messer4,910 Points
COPY failed: file not found in build context or excluded by .dockerignore: stat app.py: file does not exist
I get an error when I run the docker build command. lucard@USHA:~/MyDockerContainers/PythonWebServer$ docker build -t web-app . Sending build context to Docker daemon 2.048kB Step 1/9 : FROM ubuntu:latest ---> 27941809078c Step 2/9 : RUN apt-get update -y ---> Using cache ---> 35c89d12da8c Step 3/9 : RUN apt-get install -y python3 ---> Using cache ---> 923ed7428ee3 Step 4/9 : ENTRYPOINT ["python3"] ---> Using cache ---> e8e28a145519 Step 5/9 : CMD ["app.py"] ---> Using cache ---> 92a2d00bfe4e Step 6/9 : WORKDIR /app ---> Using cache ---> 2715748c5744 Step 7/9 : COPY app.py app.py COPY failed: file not found in build context or excluded by .dockerignore: stat app.py: file does not exist
This is my Dockerfile
Dockerfile for building a Python web service
Pull base image.
Commands to run to install dependencies
RUN apt-get update -y RUN apt-get install -y python3
When you pass commands to the container, what should interpert them
Coomand to run when the container starts.
Copy apps from the local folder to the Docker Container
COPY app.py app.py COPY alternate.py alternate.py