Skip to content

Fix behavior of absolute paths in .dockerignore#32088

Merged
vdemeester merged 1 commit intomoby:masterfrom
simonferquel:windows-dockerignore-fix
Jun 13, 2017
Merged

Fix behavior of absolute paths in .dockerignore#32088
vdemeester merged 1 commit intomoby:masterfrom
simonferquel:windows-dockerignore-fix

Conversation

@simonferquel
Copy link
Contributor

Fix #30676

According to documentation (https://docs.docker.com/engine/reference/builder/#dockerignore-file), absolute paths like /foo/bar should have the same effect as foo/bar. This is not the case today.

This fix normalize paths when reading the .dockerignore file by removing
leading slashes.

- What I did

Fix .dockerignore parsing such that /foo/bar is equivalent to foo/bar

- How I did it

I normalized the .dockerignore patterns in the .dockerignore file reader so that /foo/bar is read as foo/bar

- How to verify it

Unit tests cover that.

- Description for the changelog

Fixed a bug where .dockerignore file entries written as /foo/bar would not match anything

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simonferquel
Copy link
Contributor Author

I'll fix the test regression on Monday

@simonferquel simonferquel force-pushed the windows-dockerignore-fix branch from 11fd5c3 to aec0deb Compare March 27, 2017 08:38
According to documentation (https://docs.docker.com/engine/reference/builder/#dockerignore-file), absolute paths like `/foo/bar` should have the same effect as `foo/bar`. This is not the case today.

This fix normalize paths when reading the .dockerignore file by removing
leading slashes.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
@thaJeztah
Copy link
Member

ping @duglin @tonistiigi PTAL

Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tonistiigi
Copy link
Member

cc @duglin

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐸

@vdemeester vdemeester merged commit c21c17c into moby:master Jun 13, 2017
@tonistiigi tonistiigi added the area/builder Build label Jun 13, 2017
nakanokurenai pushed a commit to nakanokurenai/certbot-dns-conoha that referenced this pull request Jun 19, 2018
I want to use Docker Hub automattic build, top on 17.06.
Pathes with leading '/' was available from 17.07.0-ce. That behavor fixed by patch 'Fix .dockerignore entries with a leading / not matching anything' patch. See moby/moby#32088
nakanokurenai pushed a commit to nakanokurenai/certbot-dns-conoha that referenced this pull request Jun 19, 2018
I want to use Docker Hub automattic build, top on 17.06.
Pathes with leading '/' was available from 17.07.0-ce. That behavor fixed by patch 'Fix .dockerignore entries with a leading / not matching anything' patch. See moby/moby#32088
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected behavior at .dockerignore file

6 participants