运行Dockerfile时由终端输入

pn9klfpd  于 2023-02-03  发布在  Docker
关注(0)|答案(1)|浏览(145)

我有一个Dockerfile,我想在其中运行以下命令以获取Rust and Cargo
RUN curl https://sh.rustup.rs -sSf | sh
但是,当在终端中手动执行它时(不是在Dockerfile中,而是只运行curlhttps://sh.rustup.rs-sSf|sh),它要求我包括手动安装的类型:

Current installation options:

   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
> 1 (this is what i enter)

因此,当在Dockerfile中执行上述操作时,不可能选择该选项,并且会出现以下错误。

Step 3/6 : RUN curl https://sh.rustup.rs -sSf | sh
 ---> Running in d03d6ff33b9f
info: downloading installer
rustup: Unable to run interactively. Run with -y to accept defaults, --help for additional options
The command '/bin/sh -c curl https://sh.rustup.rs -sSf | sh' returned a non-zero code: 1

你知道我应该如何在Dockerfile中继续介绍1)继续安装(默认)并避免错误吗?
先谢谢你

相关问题