cclloyd
cclloyd

Reputation: 9205

Dockerfile hide output of RUN command

If I have a few RUN commands in my Dockerfile, how can I have it not print any output from a specific command, such as ignoring the printed statements from an apt-get update?

Upvotes: 2

Views: 10162

Answers (1)

Alex028502
Alex028502

Reputation: 3814

This works for me

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

(really got the solution from Redirecting command output in docker)

Upvotes: 4

Related Questions