Confused about creating an image based on another

I’m new to Docker, but so far I really like it. There is something which I don’t understand though.

If I build an image containing say a web server, and then create other, project-specific, images from that one (using the FROM command), should I add “example” files in my new base image?

It may sound like a weird question, but the reason I am asking is because when I am looking at other peoples’ base images on the internet, they always add for example a Hello world app to it. Basically you can download their image and run it and it will work. But I feel like it would be better to just not add any example files to it, because otherwise every single one of my project-specific dockerfiles needs to run “rm -r -f /code” (if I were to store the code there) before doing anything else.

Why do people usually include those example files?

I generally do it so both I, and any potential users can test the image’s
operation.

its a good point though.

Sven

Docker Engineer
Ask me anything …
Brisbane, Australia (UTC+10)

I guess that makes sense too (which is why I posted this instead of just
going the logical way right away). So I suppose you do some kind of cleanup
in every dockerfile that uses this other base image? Or do you not care about
the leftovers?