Description
This is a strange case maybe, but it's something that works on the command line so I thought it might be considered a bug.
I have a .dockerignore
file in my project that is just *
to ignore all files (to speed up building the image by not copying everything in the project to docker), and when I try to build my container, I get the error:
Generated at 2017-05-22 10:26:53 -0400
Docker::Error::ServerError: docker_image[bdcreporter-wordpress] (bdcreporter::docker_images line 18) had an error: Docker::Error::ServerError: Cannot locate specified Dockerfile: Dockerfile
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/docker-api-1.33.2/lib/docker/connection.rb:50:in `rescue in request'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/docker-api-1.33.2/lib/docker/connection.rb:38:in `request'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/docker-api-1.33.2/lib/docker/connection.rb:65:in `block (2 levels) in <class:Connection>'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/docker-api-1.33.2/lib/docker/image.rb:259:in `build_from_tar'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/docker-api-1.33.2/lib/docker/image.rb:278:in `build_from_dir'
The problem is, docker-api is reading the .dockerignore
file when building the tar to send to docker and is building the tar without even the Dockerfile
.
I've tried adding the newly supported negation syntax to my Dockerfile
:
*
!Dockerfile
but this doesn't work either, I still get the error.
Maybe Dockerfile
should be a special case and always be included?
Thanks! I use this library via the Docker chef cookbook every day.
EDIT: I can workaround this problem by just building from the Dockerfile rather than building from the directory.
-Caleb