devcontainers / devcontainers/cli

X11 works with container launched via VSCode but not launched via devcontainers/cli

Open
#869 3 comments 1 reaction 1 assignee Claimed by @chrmarti View on GitHub
feature-request
Dominant language
TypeScript
Stars
3k
Forks
457
Avg merge
13h 17m
Merged PRs (30d)
6

Description

I have a script called `devshell` (relevant code below), which is intended to start the devcontainer if not always running, then give you a shell into the container.

When I start the container _in VSCode_, then in a separate terminal (outside vscode) run devshell, I can launch a GUI application like xterm no problem.

If instead, I stop VSCode and the running devcontainer, then run the `devshell` script below, `xterm` and other X11 applications do not work. It seems to me `devcontainer up` does something different than vscode itself when preparing the container for execution.

Here is the relevant except of `devshell` (the only missing contents are boilerplate setup and making sure we are in the right directory, etc):

```
devcontainer up --workspace-folder .

WORKDIR=/workspaces/${REPONAME}
CONTAINER_NAME=${REPONAME}_devcontainer

# Run a shell in the container
docker exec -it -e DISPLAY=":0" -w ${WORKDIR} ${CONTAINER_NAME} /bin/bash "$@"
```

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.