Skip to content

Exception patterns in .dockerignore do not support wildcard directories #30018

@taylortrimble

Description

@taylortrimble

Description

Exception patterns in .dockerignore do not support wildcard directories. I expect to be able to write exception rules like !*/*.txt.

Steps to reproduce the issue:

  1. Assume the following files in the Docker context:
$ find . -type f
./.dockerignore
./Dockerfile
./hi.txt
./ignoreme.txt
./photos/steak.jpeg
./recipes/cake.txt
  1. Assume the following .dockerignore (specs):
*
!hi.txt
!photos/*.jpeg
!*/*.txt
  1. Assume the following Dockerfile:
FROM debian:8.5
WORKDIR /srv
COPY . ./
  1. Build the Docker image and run find . from it:
$ docker build -t test-di .
$ docker run --rm test-di find . -type f

Describe the results you received:

Output of docker run:

./photos/steak.jpeg
./hi.txt

./recipes/cake.txt, matching the exception rule !*/*.txt, is missing.

Describe the results you expected:

./photos/steak.jpeg
./recipes/cake.txt
./hi.txt

./recipes/cake.txt, matching the exception rule !*/*.txt, is present.

Additional information you deem important (e.g. issue happens only occasionally):

This change was likely introduced by #20872. cc/ @duglin @icecrime @vdemeester

Output of docker version:

Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 06:14:34 2016
 OS/Arch:      darwin/amd64

Server:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 05:02:53 2016
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 6
 Running: 0
 Paused: 0
 Stopped: 6
Images: 145
Server Version: 1.12.1
Storage Driver: devicemapper
 Pool Name: docker-8:0-128926-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 107.4 GB
 Backing Filesystem: ext4
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 7.207 GB
 Data Space Total: 107.4 GB
 Data Space Available: 41.11 GB
 Metadata Space Used: 10.95 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.137 GB
 Thin Pool Minimum Free Space: 10.74 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.90 (2014-09-01)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: null bridge host overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options:
Kernel Version: 4.8.3-x86_64-linode76
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.856 GiB
Name: ivysaur.tntapp.co
ID: MYEL:ZPVM:FQYY:JATZ:VPK3:L25L:3JVD:LNXO:J4XP:HSFV:6VY4:YJIY
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8

Additional environment details (AWS, VirtualBox, physical, etc.):

This issue should affect only the client.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions