microsoft / microsoft/vscode-remote-release

"name.Dockerfile.dockerignore" no longer applies to dev container build

Open
#10,460 3 comments 0 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since Nov 12, 2024.

bug containers
Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

  • VSCode Version: 1.95.1
  • Local OS Version: Pop!_OS 22.04
  • Remote OS Version: n/a
  • Remote Extension/Connection Type: Containers

When pointing VSCode at a named devcontainer Dockerfile, e.g dc.Dockerfile, then according to the Docker Spec, dc.Dockerfile.dockerignore should be used if it is found next to the named devcontainer dockerfile.

This used to work when I set up some dev containers around August/September. Now, it no longer does.

Repro is at https://github.com/jwhitaker-gridcog/devcontainers-repro , or briefly:

.devcontainer/devcontainer.json
{
	"name": "Default Linux Universal",
	"build": {
		"dockerfile": "dc.Dockerfile",
		"context": ".."
	}
}
.devcontainer/dc.Dockerfile
FROM mcr.microsoft.com/devcontainers/universal:2-linux

COPY . .

# testfile should be EXCLUDED from the docker context, as per dockerignore
RUN if [ -f testfile ]; then echo 'test failed'; exit 1; else echo 'all good'; fi

.devcontainer/dc.Dockerfile.dockerignore
testfile
testfile
# blank file

Expected behaviour: the image in the repro should build successfully, as testfile should be excluded from its build context.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.