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

Fix behavior of absolute paths in .dockerignore #32088

Merged
merged 1 commit into from Jun 13, 2017

Conversation

Projects
None yet
6 participants
@simonferquel
Contributor

simonferquel commented Mar 24, 2017

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

@simonferquel

This comment has been minimized.

Show comment
Hide comment
@simonferquel

simonferquel Mar 24, 2017

Contributor

I'll fix the test regression on Monday

Contributor

simonferquel commented Mar 24, 2017

I'll fix the test regression on Monday

Fix behavior of absolute paths in .dockerignore
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

This comment has been minimized.

Show comment
Hide comment
@thaJeztah
Member

thaJeztah commented May 16, 2017

ping @duglin @tonistiigi PTAL

@tonistiigi

LGTM

@tonistiigi

This comment has been minimized.

Show comment
Hide comment
@tonistiigi
Member

tonistiigi commented Jun 6, 2017

cc @duglin

@vdemeester

LGTM 🐸

@vdemeester vdemeester merged commit c21c17c into moby:master Jun 13, 2017

6 checks passed

dco-signed All commits are signed
experimental Jenkins build Docker-PRs-experimental 34242 has succeeded
Details
janky Jenkins build Docker-PRs 42843 has succeeded
Details
powerpc Jenkins build Docker-PRs-powerpc 3226 has succeeded
Details
windowsRS1 Jenkins build Docker-PRs-WoW-RS1 14078 has succeeded
Details
z Jenkins build Docker-PRs-s390x 2946 has succeeded
Details

nakanokurenai added a commit to nakanokurenai/certbot-dns-conoha that referenced this pull request Jun 19, 2018

Dockerfile: support docker versions before 17.07.0-ce
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 added a commit to nakanokurenai/certbot-dns-conoha that referenced this pull request Jun 19, 2018

Dockerfile: support docker versions before 17.07.0-ce
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