devcontainers / devcontainers/cli

Building devcontainers does not use .dockerignore file next to the Dockerfile.

Open
#969 7 comments 9 reactions 1 assignee Claimed by @chrmarti View on GitHub
bug
Dominant language
TypeScript
Stars
3k
Forks
457
Avg merge
13h 17m
Merged PRs (30d)
6

Description

Hi, is it possible that the .dockerignore file next to the Dockerfile is not being used to ignore files in the build context?

I used to think only the .dockerignore file in the root of the Docker build context was used and I know that it is not possible to specify another .dockerignore file using command line arguments (e.g. `-i path/to/.dockerignore`).
Then I read about this file naming workaround: [Filename and location](https://docs.docker.com/build/concepts/context/#filename-and-location).

This works fine when I use `docker compose build`, `docker buildx build`, and `docker buildx bake`.
However, opening in a container, this `Dockerfile.dockerignore` next to my `Dockerfile` is not being used, while the one in the root of my context is working.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.