Skip to content

devcontainers lack bash-completion #1164

@thetredev

Description

@thetredev

I was messing around with devcontainers lately and I realized that there was no bash completion for the docker command inside a devcontainer with the docker-in-docker feature enabled like this:

"features": {
    "ghcr.io/devcontainers/features/docker-in-docker:2": {
      "version": "latest",
      "moby": true,
      "azureDnsAutoDetection": false,
      "defaultDockerAddressPool": "172.19.0.0/16,size=24",
      "installDockerBuildx": true
    }
  }

I boiled it down to .bashrc not being evaluated, because the shell that is launched inside the devcontainer is not a login shell (e.g., /bin/bash called without -l). This is also the case for the mcr.microsoft.com/devcontainers/base image for example, which has the following values for ENTRYPOINT and CMD:

"Cmd": [
  "bash"
],
"Entrypoint": null,

I tried pointing the devcontainer to a Dockerfile with modified ENTRYPOINT and CMD to no avail:

{
  "name": "Test container",
  "build": {
    "dockerfile": "Dockerfile"
  }
}
FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm

ENTRYPOINT [ "/bin/bash", "-l" ]
CMD []

Is there anything we can do from the user side to workaround the issue? It would be best if VS Code would run a login shell inside the devcontainer but I guess that is a VS Code issue rather than a devcontainer one, so I guess a workaround would be fine, considering that you might not even want a login shell in certain scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions