Skip to content

"Dockerfile is excluded by pattern" error seems incorrect #286

@llamahunter

Description

@llamahunter

I have a .dockerignore file that includes the following:

*
!Dockerfile

But I am getting an error message:

Dockerfile is excluded by pattern '*' on line 1 in .dockerignore file

However, my reading of the docker docs (https://docs.docker.com/reference/builder/#dockerignore-file) indicates that this should be ok, in particular:

The placement of ! exception rules influences the matching algorithm; the last line of the .dockerignore that matches a particular file determines whether it is included or excluded.

Additionally, the docs go on to say

You can even use the .dockerignore file to ignore the Dockerfile and .dockerignore files. This is useful if you are copying files from the root of the build context into your new container but do not want to include the Dockerfile or .dockerignore files (e.g. ADD . /someDir/).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions