docker image directory does not exist during build

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



docker image directory does not exist during build



I'm building a simple image from a Dockerfile: (note, pm3 is the name of the folder this Dockerfile lives in)


pm3


FROM continuumio/miniconda3
MINTAINER Jordan Miller
ENV PORT=5000
COPY . /opt/repos/
WORKDIR /opt/repos/pm3/

RUN ls -la

RUN python /opt/repos/pm3/lib/acquire_requirements.py

EXPOSE $PORT
ENTRYPOINT ["python","/opt/repos/pm3/src/web/api.py"]



I use docker build -f Dockerfile -t jm/pm3 . to build it. Now I thought this was working great last week, but I made some changes and it broke. so I ran docker system prune to clean everything out. But that didn't fix it so I think it's something wrong with the code.


docker build -f Dockerfile -t jm/pm3 .


docker system prune



At any rate, here's the error I get:


Step 7/9 : RUN python /opt/repos/pm3/lib/acquire_requirements.py
---> Running in f842a282a6a0
Invalid requirement: '/opt/repos/pm3/lib/acquire_requirements.py'
File '/opt/repos/pm3/lib/acquire_requirements.py' does not exist.



But it really is there, in my windows machine there's a lib folder in the pm3 folder and there is a acquire_requirements.py in the lib folder. should I not include the entire path to it on the linux box or something?


lib


pm3


acquire_requirements.py


lib



I included that line RUN ls -la after it gave me the error because I wanted to see if it copied over the folder correctly. but the output of that didn't show me anything had copied over, it showed an empty file. so I don't understand really what's going on. If the working directory really is /opt/repos/pm3 then shouldn't I see src when I run ls?


RUN ls -la


/opt/repos/pm3


src


ls



I'm hoping there's something obvious about linux or docker that I'm missing here. any ideas?





Do you have .dockerignore file? Also, you are running docker build in the same directory as the Dockerfile right? Can you update with the contents of the pm3 directory?
– Jack Gore
Aug 7 at 19:24


.dockerignore


docker build


pm3




1 Answer
1



so I discovered by creating an image without the RUN python /opt/repos/pm3/lib/acquire_requirements.py that it doens't create a folder after the /opt/repos/ called pm3 like my root directory of the Dockerfile is in.


RUN python /opt/repos/pm3/lib/acquire_requirements.py


/opt/repos/


pm3



So I had to add that in manually to the command:



COPY . /opt/repos/ -> COPY . /opt/repos/pm3/


COPY . /opt/repos/


COPY . /opt/repos/pm3/






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS