The mistake is in the confusion between CMD and RUN.
According to Docker’s documentation, the instruction CMD serves primarily to indicate the parameters to be used by the entrypoint of a container. And adds that Dockerfile must contain a SINGLE instruction CMD and if more than one is added, only the last will have effect.
This is precisely the problem of your Dockerfile. First, even if CMD ["git","clone","https://github.com/Renan-Sacca/teste-docker.git"] were correct, it would be ignored because there is another CMD. Although there was no other CMD is used only at the time of container startup. That’s why when making RUN pip3 install -r requirements.txt there is no requirements.txt.
To execute instructions in the build of an image you must use the RUN. That way, your Dockerfile should be something like
FROM python:3.6.7
LABEL maintainer="RENAN SACCA"
EXPOSE 8000
RUN git clone https://github.com/Renan-Sacca/teste-docker.git
WORKDIR teste-docker
RUN pip3 install -r requirements.txt
CMD ["python3", "main.py"]
Obs:
- the instruction
MAINTAINER is obsolete and has been replaced by LABEL;
- the instruction
EXPOSE was moved to improve the readability of the code;
I get it, I’m learning middle of zero so I didn’t know this from cmd, I tested the code that left and worked, thank you very much for the help
– Renan Sacca