Will Squire
Will Squire

Reputation: 6595

Cannot create new Rust project with Docker: "could not determine the current user"

Following the Docker documentation for Rust, I can't create a new project using cargo new without getting could not determine the current user, please set $USER. Here's the command I'm using:

docker run -it --rm -v "$PWD":/app -w /app rust:1.27.0-slim-stretch cargo new project --bin

Upvotes: 6

Views: 2587

Answers (2)

techkuz
techkuz

Reputation: 3956

If you need to fix this inside the container, run: $ export USER=yourname

Upvotes: 2

Will Squire
Will Squire

Reputation: 6595

Forwarding the $USER environment variable from my machine seems to do the trick:

docker run -it --rm -e USER=$USER -v "$PWD":/app -w /app rust:1.27.0-slim-stretch cargo new project --bin

Upvotes: 12

Related Questions