Skip to content

MCR Rust Image - Ensure Correct Permissions - Breaks User-level Usage of cargo build #21

@CodeMan99

Description

@CodeMan99

devcontainer.json

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
	"name": "Rust",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	"image": "mcr.microsoft.com/devcontainers/rust:0-1-bullseye",

	// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
	// "mounts": [
	// 	{
	// 		"source": "devcontainer-cargo-cache-${devcontainerId}",
	// 		"target": "/usr/local/cargo",
	// 		"type": "volume"
	// 	}
	// ]

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Use 'postCreateCommand' to run commands after the container is created.
	// "postCreateCommand": "rustc --version",

	// Configure tool-specific properties.
	"customizations": {
		"vscode": {
			"extensions": [
				"bierner.github-markdown-preview",
				"DavidAnson.vscode-markdownlint",
				"GitHub.vscode-github-actions"
			]
		}
	},

	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
	"remoteUser": "vscode",

	// Features to add to the dev container. More info: https://containers.dev/features.
	"features": {
		"ghcr.io/devcontainers/features/git:1": {},
		"ghcr.io/devcontainers/features/github-cli:1": {},
		"ghcr.io/dhoeric/features/oras:1": {},
		"ghcr.io/lee-orr/rusty-dev-containers/bacon:0": {},
		"ghcr.io/lee-orr/rusty-dev-containers/cargo-binstall:0": {},
		"ghcr.io/lee-orr/rusty-dev-containers/cargo-watch:0": {}
		// "ghcr.io/lee-orr/rusty-dev-containers/sscache:0": {}
	}
}

Broken Build

This is after re-building my devcontainer.

vscode ➜ /workspaces/devconf (main) $ cargo build
    Updating crates.io index
  Downloaded fnv v1.0.7
error: failed to download replaced source registry `crates-io`

Caused by:
  failed to open `/usr/local/cargo/registry/cache/index.crates.io-6f17d22bba15001f/fnv-1.0.7.crate`

Caused by:
  Permission denied (os error 13)
vscode ➜ /workspaces/devconf (main) $ ll /usr/local/cargo/ 
total 24K
drwxrwxrwx 1 root   root     4.0K Oct 20 23:44 bin
drwxr-sr-x 1 root   rustlang 4.0K Oct 20 23:42 binstall
-rw-rw-rw- 1 root   root      308 Jun  4 18:13 env
drwxr-sr-x 4 vscode rustlang 4.0K Oct 26 05:34 git
drwxr-sr-x 5 root   rustlang 4.0K Oct 20 23:42 registry

I am pretty sure that the registry folder should have write permission for the group.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions