Menu

Docker Compose security: hardening one file, from 12 findings to none
📰

Docker Compose security: hardening one file, from 12 findings to none

DEV Community: docker·Todd Matens·about 14 hours ago
#POa0cB5a
#devtodocker#devto#dev#host#file
Reading 0:00
15s threshold

Earlier this year I ran compose-lint , a security linter for Docker Compose files that I maintain, against 11,111 public Compose files from GitHub. Of the ones that parsed, 99.2% had at least one security finding. I don't think that says much about the people who wrote them. Docker gives a container some protection by default, but most of the optional hardening is left for you to turn on, and most of the examples people copy from don't.

The study shows how common each gap is, but it doesn't show how to close them. That's what this post is for. I took an ordinary two-service file, nginx in front of Postgres, and hardened it one setting at a time. For each step I show the change, explain why it matters, and give the share of files in the study that skip it. Every percentage is a share of the 5,907 files that parsed. The finished file is at the end, with a checklist.

Some of these settings will break a service the first time you turn them on, and I've tried to say where.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.