4 ms·
Isn't this the same? RUN apk update && apk upgrade && apk add foo
by hiram112 6y ago
Isn't this the same?
RUN apk update && apk upgrade && apk add foo
- kelnos 6y agoIt is, but the syntax is uglier. Also imagine that you might want to do more than just RUN in a single layer. Maybe COPY some file into the container and then RUN something that uses it.
- yjftsjthsd-h 6y agoIn the simple case, yes it is, but it scales poorly; consider ex. https://github.com/docker-library/postgres/blob/b9c080857b880202ebd23c59d33fe86d7a70fea3/13/alpine/Dockerfile#L24 https://github.com/docker-library/postgres/blob/b9c080857b88... which is 112 lines run together like that to keep things in a single layer. This is pretty bad for readability. Also, as sibling comment notes, that only works for RUN commands, not other or mixed groups of commands.
- topspin 6y agoSpend some time on docker hub and you'll find thousands of Dockerfiles with RUN <150 lines of && concatentated scripts>. It's dysfunctional.
- wildpeaks 6y agoGood to know, I often wondered why people produced these giant RUN statements instead of making multiple RUN.