如何在 Dockerfile 中正确使用 apt install

这是在 Dockerfile 中使用 apt install 的正确方式:

example-1.dockerfile
RUN apt update && apt install -y PACKAGE && rm -rf /var/lib/apt/lists/*

关键要点:

另请参见Dockerfile 最佳实践官方指南


Check out similar posts by category: Container, Docker