如果我有几个RUN
我的 Dockerfile 中的命令,如何让它不打印特定命令的任何输出,例如忽略 apt-get update
中的打印语句?
最佳答案
这对我有用
FROM ubuntu:16.04
RUN which nano || echo no nano
RUN bash -c "apt-get update &> /dev/null"
RUN bash -c "apt-get install nano &> /dev/null"
RUN which nano
(确实从 Redirecting command output in docker 得到了解决方案)
关于Dockerfile 隐藏 RUN 命令的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50147909/