【问题标题】:How do I install (anything) on debian: 'apt is unknown instruction' in Dockerfile如何在 debian 上安装(任何东西):Dockerfile 中的“apt 是未知指令”
【发布时间】:2021-11-27 01:40:03
【问题描述】:

如何在 debian 上安装(任何东西):Dockerfile 中的“apt is unknown instruction”

如果我搜索:[如何在 debian 上安装 wget]

我收到的文章说:

$sudo apt install wget


所以我尝试在 Docker 中这样做:

FROM debain
apt install wget

我得到了这个错误

/full/path/to/current/working/directory                          
[+] Building 0.1s (2/2) FINISHED                                                                                                  
 => [internal] load build definition from Dockerfile                                                                         0.0s 
 => => transferring dockerfile: 102B                                                                                         0.0s 
 => [internal] load .dockerignore                                                                                            0.0s 
 => => transferring context: 2B                                                                                              0.0s 
failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 2: unknown instruction: 
                                                                                                                                  
APT                                                                                                                               
/full/path/to/current/working/directory
                                                                         

--

这可能是什么问题?

【问题讨论】:

  • "apt" 不是 docker 命令。

标签: dockerfile debian wget apt apt-get


【解决方案1】:

你需要添加RUN指令,像这样:

FROM debian
RUN apt install wget

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-04
    • 1970-01-01
    • 2019-02-28
    • 2012-09-06
    • 1970-01-01
    • 2018-11-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多