#6393·tilt

dockerignore with globs creates empty folders

Author: cl3m0Created Jun 12, 2024Updated Aug 25, 2026
Labelsbug

Expected Behavior

Tilt should behave same as docker when using .dockerignore files. In particular it should be able to use the ** pattern to ignore all files and directories but allow the ! pattern to include specific files.

Current Behavior

When using the ** pattern of .dockerignore to exclude everything, including a folder containing some files, in combination with the ! pattern to include some files using a glob (*), the folder is not ignored but created without containing files. i.e.

# exclude all files
**

# include only files matching pattern
!file*.txt

Steps to Reproduce

  1. Checkout project from https://github.com/bettermarks/tilt-dockerignore
  2. Run tilt up
  3. Check the logs for the output of ls -al

Context

tilt doctor Output

$ tilt doctor
Tilt: v0.33.16, built 2024-06-07
System: linux-amd64
---
Docker
- Host: unix:///var/run/docker.sock
- Server Version: 26.1.4
- API Version: 1.45
- Builder: 2
- Compose Version: v2.27.1
---
Kubernetes
- Env: kind
- Cluster Name: kind-bm-local
- Container Runtime: containerd
- Version: v1.27.3
- Cluster Local Registry: &RegistryHosting{Host:localhost:5002,HostFromClusterNetwork:ctlptl-registry:5000,HostFromContainerRuntime:,Help:https://github.com/tilt-dev/ctlptl,SingleName:,}
---

About Your Use Case

We were facing this issue when Tilt was copying a local python virtualenv folder to the image containing empty site-package folders which led to failures starting the python project.