Comment

Comment by orf

> # install chromedriver

> RUN apk update

> RUN apk add chromium chromium-chromedriver

These kind of poor examples lead to a huge amount of waste when using Docker because people learning it are not taught about how layers interact, leading to ridiculous things like 'COPY' followed by 'RUN chown'.

Layers are a _core_ part of how Docker works, why not make this example "correct" by doing:

> RUN apk --no-cache add chromium chromium-chromedriver

Then just a comment like this: "it's important to group layers if possible to reduce your image size. By using `--no-cache` apk will update at the same time as installing".

parent orf 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton