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
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
If you need to fix this inside the container, run:
$ export USER=yourname
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With