Skip to content
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

Mount volume with Docker ONBUILD #12827

Closed
saturnism opened this issue Apr 27, 2015 · 11 comments
Closed

Mount volume with Docker ONBUILD #12827

saturnism opened this issue Apr 27, 2015 · 11 comments
Labels
area/builder kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny

Comments

@saturnism
Copy link
Contributor

Just used Maven image to turn Java source to image on build! Maven will downloads all the dependencies into /root/.m2/repository directory. But since the fs is not persistent, Maven will download all the dependencies on every single build.

It would be great if we can mount the repository directory when building - so that the dependencies don't need to be re-downloaded each time.

@vdemeester
Copy link
Member

Yep, agree but not sure that's the right place for this issue. Would probably be better here or even better, here.

@saturnism
Copy link
Contributor Author

hm, i don't think it's the image's issue in this case. using docker build doesn't allow mounted volumes.

@thaJeztah thaJeztah added the kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny label May 4, 2015
@thaJeztah
Copy link
Member

If I understand your use-case correctly, this looks like a duplicate of #3056 (and #10199)

@saturnism can you confirm that this is the case (and close this issue if I'm correct)?

@saturnism
Copy link
Contributor Author

pretty similar - but should work in ONBUILD too :)

@cpuguy83
Copy link
Member

Why is the dir not persistent?
This is completely the image's issue if they have placed a volume at the repo path.

@saturnism
Copy link
Contributor Author

actually, this is very specific to some build processes that pulls down dependencies. rather than re-downloading the dependencies each build, dependencies are already versioned and static, it can be shared via a volume.

for example, when building w/ maven:onbuild, it will pull down many dependencies from maven central. however, in a regular maven build environment, all of the dependencies are cached in ~/.m2/repository directory.

it would be super nice if that' can be shared via a volume.

thanks,

@saturnism
Copy link
Contributor Author

This will also be super helpful when building on remote docker machines

@GordonTheTurtle
Copy link

USER POLL

The best way to get notified of updates is to use the Subscribe button on this page.

Please don't use "+1" or "I have this too" comments on issues. We automatically
collect those comments to keep the thread short.

The people listed below have upvoted this issue by leaving a +1 comment:

@cyberjoac

@gkozyryatskyy
Copy link

gkozyryatskyy commented Dec 27, 2016

+1
@saturnism Do you use something like a "workaround" for this issue? How exactly you do that? =)

@gkozyryatskyy
Copy link

gkozyryatskyy commented Dec 27, 2016

same issue #17745
and seems like work going in #14080

@cpuguy83
Copy link
Member

With the buildkit builder you can mount cache mounts. Cache mounts can be just an empty dir that gets populated during the build, or it can even be an overlay from a pre-populated dir, from another build stage, etc.

https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md#run---mounttypecache

Closing since this should resolve most cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/builder kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny
Projects
None yet
Development

No branches or pull requests

7 participants