devcontainers / devcontainers/features

devcontainers lack bash-completion

Open
#1,164 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Shell
Stars
1.5k
Forks
621
Avg merge
2d 11h
Merged PRs (30d)
4

Description

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:
```json
"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"
}
}
```
```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.

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.