Skip to content

Keep readonly-volume-mounted config.json #119

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

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

toshikish
Copy link
Contributor

Fixes #104.

Bug description

The config.json deletion code

err = os.Remove(filepath.Join(os.Getenv("DOCKER_CONFIG"), "config.json"))

seems intended to delete previously generated temporary one.
err = os.WriteFile(filepath.Join(MagicDir, "config.json"), decoded, 0644)

But in case config.json file is volume mounted with read-only mode on Docker or Kubernetes, the deletion fails with error: remove docker config: remove /.envbuilder/config.json: device or resource busy.

Bug fix

Delete config.json only if it is generated from DOCKER_CONFIG_BASE64 environment variable.

Validation

Execute the following commands, and a deno devcontainer will run without errors.

echo '{}' > config.json
docker run --rm -it -e GIT_URL=https://github.com/denoland/deno -e INIT_SCRIPT=bash -v ./config.json:/.envbuilder/config.json:ro envbuilder:latest

@aaronlehmann aaronlehmann merged commit c1b4a9e into coder:main Apr 1, 2024
1 check passed
@toshikish toshikish deleted the keep-readonly-config-json branch April 1, 2024 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed running devcontainer with container registry secret volume mounted
2 participants