-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let Dockerfile ADD pick file from another docker image #7992
Comments
When you build from source in your docker file, add a line to CPU the build See http://docs.docker.com/userguide/dockervolumes/ for a step by step R/
|
Thanks @borromeotlhs for quick reply, I just don't understand the proposed tip. |
Well, I firstly want to point out, you would use the -v option, not -w. Besides that, the reason it'd be really convenient to use docker containers Hope that helps.
|
What I'm suggesting here is a "trusted build" compliant way to get a docker image reusing some elements from another one, not a workaround. I only know some of them, including -v, or just running |
If your container that built your source exists ( you didn't docker rmi it) and the build artifacts are stored within it, you can easily start the container back up at the exact commit, name it, expose the volume, and then run your other container to grab the exact build artifact from the trusted container ( which,BTW, is all stored on host via aufs,btrfs, etc. anyway ) |
Sure it's actually stored by host, but you don't get the idea. If I want to use trusted builds service, I can't rely on some manual steps to run container and do such things. I'm ok this is a fully valid workaround (this is the way I do today), but doing this I rely on the command I run on docker host to get my production container include the expected artifact, not on specified build-from-source docker image tag I would declare in my production Dockerfile. My issue here is about trusting the produced production image and traceability from source. |
On Thu, Sep 11, 2014 at 03:52:43PM -0700, Nicolas De loof wrote:
For previous discussions of this sort of “pure Dockerfile build |
#3949 VOLUME-FROM-IMG is indeed addressing a comparable use-case, #3949 (comment) describes this exact suggestion. |
Reading #3949 with more care, the suggested feature is to mount volumes from another image, but not make them persistent in the produced image. This let you access some third party stuff required to build a Dockerfile but that you want to exclude from produced image. This can help for my use-case but with a distinct approach. |
/cc @therealprologic |
See #4933 too |
The Functionality like what's being discussed here is indeed useful and needed in many cases, but I think the existing open issues are going to implement something which adds this functionality. |
This makes me wonder how ADD is configured to support various protocols. Seems it natively support http/https/ftp, which other protocols ? Can I plug more ? |
@ndeloof It's not wired to do something like that, it just has the code to handle those. However, the problem is that it's too magical right now. It handles remote files and local files. In additional to fetching remote files and local files, it's also extracting local tarballs. Making it add files from another image would add even more magic and would make that code even worse. That's why we've introduced COPY, to start cleaning things up and maybe get rid of ADD at some point in the future. |
The functionality can be implemented using COPY command
|
I use Dockerfile to build my project from sources. But I don't want my production Docker image to include sources, build and test tools, so I have a second Dockerfile for this purpose to COPY or ADD the built artifact that I need to extract some way from my first "build-from-sources" Dockerfile.
This feature request is about letting ADD command support a docker:// scheme so I can point to a file/directory from another docker image
The text was updated successfully, but these errors were encountered: