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

docker_image does not support running from a directory #816

Open
palfrey opened this issue Feb 2, 2017 · 4 comments
Open

docker_image does not support running from a directory #816

palfrey opened this issue Feb 2, 2017 · 4 comments

Comments

@palfrey
Copy link

palfrey commented Feb 2, 2017

Dockerfile ADD commands are often relative to a directory, but the docker_image command doesn't support any sort of "run from this directory" command. You can work around this by choosing a directory instead and this works for most situations, but it would be a useful addition.

@someara
Copy link
Contributor

someara commented Feb 2, 2017

@palfrey
Copy link
Author

palfrey commented Feb 5, 2017

Sorry, I should clarify. It supports "run from this directory" if the file you want to build from is called "Dockerfile". It doesn't support the use case I had, which was "run from this directory, but use this differently named file as the Dockerfile" (because I actually had two different Dockerfile's I wanted to run that were both in that directory). I solved this in my case by splitting everything up into separate folders and renaming the files to Dockerfile, but that won't fix everyone's situations.

@someara
Copy link
Contributor

someara commented Feb 15, 2017

I'm trying to figure out what support for this would look like....

First thing would be the interface... I image we'd need a property on docker_image and an example of it being exercised somewhere near here:

https://github.com/chef-cookbooks/docker/blob/master/test/cookbooks/docker_test/recipes/image.rb#L103-L105

Then somehow tweak this function:
https://github.com/chef-cookbooks/docker/blob/master/libraries/helpers_image.rb#L9

It really boils down to if the underlying docker-api rubygem supports doing this.

-s

@palfrey
Copy link
Author

palfrey commented Feb 18, 2017

The underlying API definitely supports it. One of the examples from docker-api is Docker::Image.build_from_dir('.', { 'dockerfile' => 'Dockerfile.Centos' }) i.e. specifying directory and Dockerfile name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants