I'm trying to build an image of Docker through the API. I have my context in a TAR file containing the Docker file and more files and folders.
The Dockerfile has several "COPY" commands for files and folders that should be placed in the container. But this doesn't work and I don't know if it is correct to reference these files that are inside the TAR so that they can be copied later.
The structure of the TAR is approximately this:
- context.tar
- Dockerfile
- /Code
- (many py files)
- entrypoint.sh
- nginx.conf
- requeriments.txt
- ...
- ...
Then in the Dockerfile there are some lines like this:
COPY nginx.conf /etc/nginx/conf.d/
COPY ./Code /api
Are these copies correct? The api interprets the TAR as the root path? The problem is that it doesn't give any error, nor in the logs appears anything, simply the final image is left halfway in the construction, I think when it have to copy the files from the tar to the container.
EDIT 1:
The truth is that it still doesn't work well, but I've noticed that by launching TWICE IN A RUN the build WORKS. The first time it is half-hearted, and the second time it succeeds in completing the process correctly. I'm afraid it's some kind of BUG.
Another thing I've done is to replace COPY with ADDS, although I think it's basically the same thing.
The TAR file:
Build request via api:
[16:09:05.650][ApiProxy ][Info ] time="2018-07-17T16:09:05+02:00" msg="proxy << POST /build?t=test%3Alatest&nocache=1&dockerfile=Dockerfile\n"