5 ms·
RUN is the escape hatch that everybody (understandably) abused. And because we do, it's maybe the first thing you think of when thinking of a Dockerfile. But in
by sverhagen 3y ago
RUN is the escape hatch that everybody (understandably) abused. And because we do, it's maybe the first thing you think of when thinking of a Dockerfile. But in the context of the other Dockerfile keywords I can probably live with calling it declarative. I'm a Java guy, I'd definitely call Maven declarative, but it surely has some escape hatches too. And what about <fill in your example>...
- sdf4j 3y agoadd COPY to the list of keywords we rather ignore so we can call Dockerfiles declarative.
- dharmab 3y agoAnd ADD (which you should almost never use instead of COPY because it does extra stuff you don't need)
- diarrhea 3y agoAbuse, how? What does not abusing it look like? Not using it is not an option either; it would make for very boring containers.
- dharmab 3y agoWith RUN you want to: 1. Be as reproducible as possible. e.g. if you're using RUN to download a file, check the hash to ensure that someone building the image in the future gets the same file. Lock your dependency versions wherever possible. Sometimes this is impractical, e.g. OS packages in most Linux distros expect other packages to be mostly up to date. 2. Separate RUN commands so that more frequently changed content is created later in the Dockerfile, to maximize caching.