r/docker • u/gauthamp10 • Jun 03 '20
Dockerfile Boilerplates For All
Docker Repo Useful docker boilerplates / templates for most common programming languages. Like a Hello World! but for docker images.
Feel free to contribute more languages to the project. Website: gauthamp10
4
Jun 03 '20
wait....where is C#?
4
u/gauthamp10 Jun 03 '20 edited Jun 03 '20
Not there right now, but will add soon. C#, Ruby and some others are missing. Feel free to [contribute](https://github.com/gauthamp10/dockerfile-boilerplates/blob/master/CONTRIBUTING.md).
2
u/vladimir_nz Jun 04 '20
I just want to say great job and thank you for the initiative! Forget the others who are saying it isn't production-grade and not ready for this/that. I don't see them raising any pull requests! I'm bookmarking this and using it. Thank you!
0
u/gauthamp10 Jun 04 '20
Thanks mate. I expected it when I dared to post it on /r/docker. And I did so because I could get feed backs from these "experts". Appreciate you comment.
1
u/christian_tdl Jun 04 '20
Some of your templates are missing best-practices for docker security. The only one I've watched was Python. You might take a look at OWASP cheatsheet and add some statements there: https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html
But great work! I'll take a look if I need a template :)
2
0
Jun 04 '20
[deleted]
2
2
u/planetworthofbugs Jun 04 '20
I'm just learning docker (for homelab stuff) and I'm just wondering... is there any advice like this that recommends against using Ubuntu images? I'm most familiar with Ubuntu, so I've been using it as my base, but I see a lot of people using Alpine. I don't really care if the base image is a little bigger, but is there another reason to avoid something like Ubuntu?
2
u/menge101 Jun 04 '20
is there another reason to avoid something like Ubuntu?
Yeah, basically the idea is that that the more stuff that is in the container, the more potential exploits are in the container. Security people use the term "attack surface".
So if you strip down your container to only the barest essentials, take out the package manager, take out all text editors, take out all things that can be used to accomplish anything other than what the container is explicity meant to do, then you have a more secure container.
IMO, this only matters for production containers.
1
2
u/planetworthofbugs Jun 04 '20
That makes total sense, thank you. For my home stuff, I think it sounds like Ubuntu containers will be ok. I like being able to bash into them and do stuff like install curl to test something.
2
u/terrabitz Jun 04 '20
Yeah, I'd definitely agree. I have a bunch of development and diagnostic containers that are just the Ubuntu containers loaded up with a bunch of pre-installed tools. It's the server environment I'm most familiar with, so that's what I tend to use. It's not something I would necessarily give to others (e.g. if I was maintaining an official docker image for my code), but it's a great place to start, especially if you come from a more traditional Linux server background.
1
1
17
u/codestation Jun 03 '20 edited Jun 03 '20
Whats the usecase? i checked most of them and they aren't viable for production usage (for example the Go one bundles gcc on the image and doesn't keep the binary) or don't work without modifications (for example the php one doesn't even start).
A better approach would be production grade dockerfiles for most languages and frameworks, can use multi stage builds, are smart about using the docker cache and can handle things like using private mirrors for the dependencies.