Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Empty ${localEnv:} in mount source should skip the mount, not pass empty source to Docker

Open
#1,190 0 comments 0 reactions 1 assignee View on GitHub

@v-Kaniska244 is already working on this.

Since Apr 21, 2026.

Assessment

This issue has not been assessed yet.

Description

Problem

When a devcontainer.json defines a mount using ${localEnv:SSH_AUTH_SOCK} and the environment variable is unset or empty, the CLI resolves it to an empty string and passes source=,target=/run/ssh-agent.sock,type=bind to docker run. Docker rejects this:

invalid argument "source=,target=/run/ssh-agent.sock,type=bind" for "--mount" flag: invalid value for 'source': value is empty

This is particularly problematic when using pre-built images (via devcontainers/ci) because the mount is baked into the image's devcontainer.metadata label and cannot be overridden at runtime (the spec merges mount arrays by concatenation).

Expected behavior

When ${localEnv:VAR} resolves to empty in a mount's source, the CLI should skip that mount entirely rather than passing an invalid empty source to Docker.

Reproduction

  1. Create a devcontainer.json with:
    "mounts": [
      "source=${localEnv:SSH_AUTH_SOCK},target=/run/ssh-agent.sock,type=bind"
    ]
    
  2. Run devcontainer up in an environment where SSH_AUTH_SOCK is unset
  3. Observe Docker failure due to empty mount source

Context

  • CLI version: 0.85.0
  • Related: devcontainers/ci#166 (request to disable mounts in CI builds)
  • This affects any CI/CD environment that uses pre-built devcontainer images where the build host had SSH_AUTH_SOCK set but the runtime host does not
Dominant language
TypeScript
Stars
3k
Forks
461
Avg merge
18m
Merged PRs (30d)
5

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.

More from devcontainers/cli

All issues in devcontainers/cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.