$ tree -a
├── a.txt
├── b.txt
├── compose.yml
├── c.txt
├── Dockerfile
└── .dockerignore
$ cat compose.yml
services:
test:
build: .
volumes:
- type: bind
source: .
target: /data
$ cat Dockerfile
FROM bash
$ cat .dockerignore
a.txt
b.txt
c.txt
$ docker compose run --rm test ls -1 /data
Dockerfile
a.txt
b.txt
c.txt
compose.yml
$ docker compose run --rm test ls -1 /data | grep txt && echo FILES NOT IGNORED
a.txt
b.txt
c.txt
FILES NOT IGNORED
FILES NOT IGNORED
Why?