Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

docker

rust

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
like image 607
Will Squire Avatar asked Jul 02 '18 13:07

Will Squire


Video Answer


2 Answers

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
like image 91
Will Squire Avatar answered Oct 05 '22 16:10

Will Squire


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

like image 21
techkuz Avatar answered Oct 05 '22 16:10

techkuz