Bug 1559274

Summary: .dockerignore is not processed correctly: `/bla` entry should ignore directory named "bla" in root, but it doesn't
Product: [Fedora] Fedora Reporter: ell1e <el>
Component: dockerAssignee: Frantisek Kluknavsky <fkluknav>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: adimania, admiller, amurdaca, dwalsh, fkluknav, ichavero, jcajka, lsm5, marianne, nalin, santiago, vbatts
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: docker-1.13.1-56.git6c336e4.fc28 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-30 14:10:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description ell1e 2018-03-22 07:21:26 UTC
Description of problem:
.dockerignore `/bla` entry should ignore directory named "bla" in root, but it doesn't. The latest upstream docker release is not affected, so this bug is purely in the Fedora version of docker. Also see here for a documentation how .dockerignore should behave: https://docs.docker.com/engine/reference/builder/#dockerignore-file and here for an examination of upstream behavior: https://github.com/moby/moby/issues/36660#issuecomment-375143143

Version-Release number of selected component (if applicable):
docker-1.13.1-44.git584d391.fc27

How reproducible:
100%

Steps to Reproduce:
1. Run this script (provided by @thaJeztah of docker):
mkdir repro-36660 && cd repro-36660
mkdir bla
echo '/bla' > .dockerignore
cat > Dockerfile -<<EOF
FROM busybox
RUN mkdir /copied/
COPY . /copied/
RUN ls -la /copied/
EOF
docker build --no-cache .

Actual results:
Sending build context to Docker daemon 3.584 kB
Step 1/4 : FROM busybox
Trying to pull repository docker.io/library/busybox ... 
sha256:2107a35b58593c58ec5f4e8f2c4a70d195321078aebfadfbfb223a2ff4a4ed21: Pulling from docker.io/library/busybox
d070b8ef96fc: Pull complete 
Digest: sha256:2107a35b58593c58ec5f4e8f2c4a70d195321078aebfadfbfb223a2ff4a4ed21
Status: Downloaded newer image for docker.io/busybox:latest
 ---> f6e427c148a7
Step 2/4 : RUN mkdir /copied/
 ---> Running in 14322ef9b15e
 ---> f6b034673f5b
Removing intermediate container 14322ef9b15e
Step 3/4 : COPY . /copied/
 ---> 8cfc08ced82a
Removing intermediate container fa71cd3139a9
Step 4/4 : RUN ls -la /copied/
 ---> Running in d030a3756e15
total 8
drwxr-xr-x    3 root     root            56 Mar 22 07:18 .
drwxr-xr-x   14 root     root           162 Mar 22 07:18 ..
-rw-rw-r--    1 root     root             5 Mar 22 07:17 .dockerignore
-rw-rw-r--    1 root     root            68 Mar 22 07:17 Dockerfile
drwxrwxr-x    2 root     root             6 Mar 22 07:17 bla
 ---> 77d54bee1720
Removing intermediate container d030a3756e15
Successfully built 77d54bee1720
[jonas@falcon repro-36660]$

Expected results:
Sending build context to Docker daemon 3.584 kB
Step 1/4 : FROM busybox
Trying to pull repository docker.io/library/busybox ... 
sha256:2107a35b58593c58ec5f4e8f2c4a70d195321078aebfadfbfb223a2ff4a4ed21: Pulling from docker.io/library/busybox
d070b8ef96fc: Pull complete 
Digest: sha256:2107a35b58593c58ec5f4e8f2c4a70d195321078aebfadfbfb223a2ff4a4ed21
Status: Downloaded newer image for docker.io/busybox:latest
 ---> f6e427c148a7
Step 2/4 : RUN mkdir /copied/
 ---> Running in 14322ef9b15e
 ---> f6b034673f5b
Removing intermediate container 14322ef9b15e
Step 3/4 : COPY . /copied/
 ---> 8cfc08ced82a
Removing intermediate container fa71cd3139a9
Step 4/4 : RUN ls -la /copied/
 ---> Running in d030a3756e15
total 8
drwxr-xr-x    3 root     root            56 Mar 22 07:18 .
drwxr-xr-x   14 root     root           162 Mar 22 07:18 ..
-rw-rw-r--    1 root     root             5 Mar 22 07:17 .dockerignore
-rw-rw-r--    1 root     root            68 Mar 22 07:17 Dockerfile
 ---> 77d54bee1720
Removing intermediate container d030a3756e15
Successfully built 77d54bee1720
[jonas@falcon repro-36660]$

Comment 2 ell1e 2018-05-19 01:15:42 UTC
When will a fix be shipped? Still broken in Fedora 28 right now

Comment 3 Fedora Update System 2018-05-21 11:44:38 UTC
docker-1.13.1-54.git6c336e4.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-63ae1c9b05

Comment 4 Fedora Update System 2018-05-21 11:45:24 UTC
docker-1.13.1-54.git6c336e4.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-c59142e393

Comment 5 Fedora Update System 2018-05-21 16:36:12 UTC
docker-1.13.1-54.git6c336e4.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-c59142e393

Comment 6 Fedora Update System 2018-05-21 17:16:13 UTC
docker-1.13.1-54.git6c336e4.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-63ae1c9b05

Comment 7 Fedora Update System 2018-05-23 17:45:04 UTC
docker-1.13.1-55.git6c336e4.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-c18cf994e6

Comment 8 Fedora Update System 2018-05-24 17:59:51 UTC
docker-1.13.1-55.git6c336e4.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-c18cf994e6

Comment 9 Fedora Update System 2018-05-24 22:05:42 UTC
docker-1.13.1-56.git6c336e4.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-63e6450cc4

Comment 10 Fedora Update System 2018-05-25 18:45:35 UTC
docker-1.13.1-56.git6c336e4.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-63e6450cc4

Comment 11 Fedora Update System 2018-05-30 14:10:08 UTC
docker-1.13.1-56.git6c336e4.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2018-05-30 14:32:04 UTC
docker-1.13.1-54.git6c336e4.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.