如何安装(任何东西)德比安:'apt 是未知指令'Dockerfile
如果我搜索:[如何在 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
——这里可能存在什么问题?
答案1
Dockerfile 中的有效步骤包括、、、、、FROM
等。语法参考如下:COPY
RUN
CMD
ENTRYPOINT
https://docs.docker.com/engine/reference/builder/
对于你的文件,我还建议你查看最佳实践,这将引导你走向:
FROM debain
RUN apt-get update \
&& apt-get install -y \
wget \
&& rm -rf /var/lib/apt/lists/*