Running choco as a non-root user of the docker container results in no output
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 960
- PR merge metrics
- No merged PRs in 30d
Description
### Checklist
- [X] I have verified this is the correct repository for opening this issue.
- [X] I have verified no other issues exist related to my problem.
- [X] I have verified this is not an issue for a specific package.
- [X] I have verified this issue is not security related.
### What You Are Seeing?
I created a devcontainer for my repository and setup a `vscode` user in it. When trying to run `choco` for the first time in that container, got no output. After running `sudo choco`, then was able to get output.
### What is Expected?
Expect to be able to run `choco` without first running as root.
### How Did You Get This To Happen?
1. Setup a devcontainer similar to [this one](https://github.com/corbob/ChocoPackages/blob/add-devcontainer/.devcontainer/devcontainer.json)
2. Launch the dev container
3. Run `choco`
4. Observe no output, and `$LASTEXITCODE` is 1
5. Run `choco --version`
6. Observe no output, and `$LASTEXITCODE` is 1
7. Run `sudo choco --version`
8. Observe the version number and `$LASTEXITCODE` is 0
9. Run `choco --version`
10. Observe the version number and `$LASTEXITCODE` is 0
11. Run `choco`
12. Observe a lot of file access errors as Chocolatey tries to unpack itself.
13. Run `sudo choco`
14. Observe Chocolatey outputs the version number and basic help message.
### System Details
* Operating System: Docker container
* Windows PowerShell version: NA
* Chocolatey CLI Version: 1.2.1
* Chocolatey Licensed Extension version: NA
* Chocolatey License type: NA
* Terminal/Emulator: VSCode
### Installed Packages
```bash
NA
```
### Output Log
```bash
See screenshot below.
```
### Additional Context

Suggestion from TheCakeIsNaOH is to add a `choco` command to the end of the `Dockerfile.linux` to ensure Chocolatey unpacks itself during the container build so can be run as non-root later.
Contributor guide
Research direction
Start with Dockerfile.linux and reproduce the reported sequence as a non-root user in a Docker devcontainer. Inspect when Chocolatey unpacks itself and compare the initial non-root and sudo runs. Done means choco produces its version and help output without a prior root invocation, with the relevant container behavior covered by tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, docker, powershell
- Domain
- cli, devops, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100