Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to find a working permutation of arguments to devcontainer exec #260

Closed
zdAlexM opened this issue Nov 1, 2022 · 6 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@zdAlexM
Copy link

zdAlexM commented Nov 1, 2022

both devcontainer --workspace-folder . exec bash and devcontainer exec --workspace-folder . bash report

[email protected] /Users/alex.maestas/.vscode/extensions/ms-vscode-remote.remote-containers-0.255.4

Missing required argument: workspace-folder

Adding --log-level=trace shows that both of these commands are trying to run exec in the container, which, being a shell builtin and not a binary, won't work:

$ devcontainer --log-level=trace --workspace-folder . exec /bin/sh
(node:2962) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code Helper --trace-deprecation ...` to show where the warning was created)
[10 ms] Start: Run: docker buildx version
[254 ms] Stop (244 ms): Run: docker buildx version
[254 ms] github.com/docker/buildx v0.9.1 ed00243a0ce2a0aee75311b06e32d33b44729689
[254 ms] 
[256 ms] Start: Run: git rev-parse --show-cdup
[270 ms] Stop (14 ms): Run: git rev-parse --show-cdup
[271 ms] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=/Users/alex.maestas/Code/project/a
[333 ms] Stop (62 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=/Users/alex.maestas/Code/project/a
[333 ms] Start: Run: docker inspect --type container b2f4898c02c1
[395 ms] Stop (62 ms): Run: docker inspect --type container b2f4898c02c1
[396 ms] Start: Inspecting container
[396 ms] Start: Run: docker inspect --type container b2f4898c02c131f53c8b08af7b91c5f8deb7bef812776134307722abe4c3049d
[457 ms] Stop (61 ms): Run: docker inspect --type container b2f4898c02c131f53c8b08af7b91c5f8deb7bef812776134307722abe4c3049d
[457 ms] Stop (61 ms): Inspecting container
[458 ms] Start: Run in container: /bin/sh
[461 ms] Start: Run in container: uname -m
[603 ms] x86_64
[603 ms] 
[603 ms] Stop (142 ms): Run in container: uname -m
[603 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[621 ms] NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
[621 ms] 
[621 ms] Stop (18 ms): Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[621 ms] Start: Run in container: cat /etc/passwd
[635 ms] Stop (14 ms): Run in container: cat /etc/passwd
[636 ms] userEnvProbe: loginInteractiveShell (default)
[636 ms] userEnvProbe shell: /bin/bash
[636 ms] Start: Run in container: /bin/bash -lic echo -n 6009157faff89b2fd33417c70b5726e9; cat /proc/self/environ; echo -n 6009157faff89b2fd33417c70b5726e9
[932 ms] Stop (296 ms): Run in container: /bin/bash -lic echo -n 6009157faff89b2fd33417c70b5726e9; cat /proc/self/environ; echo -n 6009157faff89b2fd33417c70b5726e9
[932 ms] 6009157faff89b2fd33417c70b5726e9HOSTNAME=b2f4898c02c1LANGUAGE=en_US:enPWD=/appHOME=/rootLANG=en_US.UTF8LS_COLORS=LESSCLOSE=/usr/bin/lesspipe %s %sLESSOPEN=| /usr/bin/lesspipe %sSHLVL=1APP_DIR=/appDISTRIB_RELEASE=20.04LD_LIBRARY_PATH=LC_ALL=en_US.UTF-8DISTRIB_CODENAME=focalPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/usr/local:/root/go/binDEBIAN_FRONTEND=noninteractive_=/usr/bin/cat6009157faff89b2fd33417c70b5726e9
[932 ms] bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

[933 ms] userEnvProbe parsed: {
  "HOSTNAME": "b2f4898c02c1",
  "LANGUAGE": "en_US:en",
  "PWD": "/app",
  "HOME": "/root",
  "LANG": "en_US.UTF8",
  "LS_COLORS": "",
  "LESSCLOSE": "/usr/bin/lesspipe %s %s",
  "LESSOPEN": "| /usr/bin/lesspipe %s",
  "SHLVL": "1",
  "APP_DIR": "/app",
  "DISTRIB_RELEASE": "20.04",
  "LD_LIBRARY_PATH": "",
  "LC_ALL": "en_US.UTF-8",
  "DISTRIB_CODENAME": "focal",
  "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/usr/local:/root/go/bin",
  "DEBIAN_FRONTEND": "noninteractive",
  "_": "/usr/bin/cat"
}
[933 ms] userEnvProbe PATHs:
Probe:     '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/usr/local:/root/go/bin'
Container: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/usr/local:/root/go/bin'
[933 ms] Start: Run in container: exec
OCI runtime exec failed: exec failed: unable to start container process: exec: "exec": executable file not found in $PATH: unknown
[1091 ms] Stop (158 ms): Run in container: exec
{"outcome":"error","message":"Command failed: exec","description":"An error occurred running a command in the container."}```
@chrmarti
Copy link
Contributor

chrmarti commented Nov 3, 2022

We need to connect stdin to the underlying docker exec. Tracking as #59. Thanks.

@chrmarti chrmarti closed this as completed Nov 3, 2022
@zdAlexM
Copy link
Author

zdAlexM commented Nov 4, 2022

@chrmarti the linked issue appears to be different. In that issue, the underlying docker exec is correctly executing /bin/bash but not connecting it to a terminal. In this issue, devcontainer exec is trying to docker exec the command exec in the container:

OCI runtime exec failed: exec failed: unable to start container process: exec: "exec": executable file not found in $PATH: unknown

@philipgiuliani
Copy link

Having the same problem with version 0.23.2. Cannot execute any command with devcontainer exec. It always fails with Missing required argument: workspace-folder even though I pass it.

I am on MacOS Ventura with Docker Desktop 4.31.1

@morriswinkler
Copy link

+1

@chrmarti chrmarti self-assigned this Dec 21, 2022
@chrmarti chrmarti added this to the January 2023 milestone Dec 21, 2022
@chrmarti chrmarti added the bug Something isn't working label Dec 21, 2022
@chrmarti chrmarti reopened this Dec 21, 2022
@chrmarti chrmarti modified the milestones: February 2023, On Deck Feb 23, 2023
@ruffsl
Copy link

ruffsl commented Apr 13, 2023

@chrmarti , any ideas? The CLI that is installed by VS Code still seems to be broken by this issue:

$ ls -l $(which devcontainer)
... /home/user/.local/bin/devcontainer -> /home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/cli-bin/devcontainer

$ devcontainer --version
0.35.0

$ devcontainer exec --workspace-folder=./ bash
...
Missing required argument: One of --container-id, --id-label or --workspace-folder is required.

And there doesn't seem to be a simple way to instruct VS Code to downgrade:

@chrmarti chrmarti modified the milestones: On Deck, April 2023 Apr 14, 2023
@chrmarti
Copy link
Contributor

Found it, preparing a fix for the next Dev Containers extension pre-release version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants