Closed bensonmiller closed 10 years ago
I hesitate to put the config file in the image itself because 1) it is unnecessary to the image and 2) it is often unique to the user and thus would cause issues for shared contexts. I think the solution is to add an option to knife container docker build
that would allow you to specify a path to a berks config.
Sounds good.
When knife-container runs
berks upload
during the build phase (see therun_berks_upload
method incontainer_docker_build.rb
), berks will find the configuration file at~/.berkshelf/config.json
, but won't find local configuration files within a chef-repo. For example, when I runknife container docker build <params>
within a chef-repo that contains a local config atchef-repo/.berkshelf/config.json
, Berkshelf doesn't find it. The cause is that the CWD for theberks upload
command has changed to the Docker context (chef-repo/dockerfiles/my_context
) and berks doesn't do any recursive upward searching for.berkshelf
directories to locate config files.Some possible solutions:
--berks
option is true forknife container docker init . . .
AND there is a.berkshelf/config.json
in the CWD where you execute the init command, copy that config todockerfiles/new_context/.berkshelf/config.json
. With this solution, berks will pick up the local config automatically when executed from within the Docker context directory..berkshelf/config.json
in the CWD where you've run the build command, just tack-on the appropriate-c <file>
command toberks upload
. With this solution, users don't need to explicitly specify a berks config, but the configuration won't be added to the Docker context.I like a combination of 1 and 2, but I need to see how things work when I add the berks configuration to the Docker context. I'll start working on this.