DevOps.com

  • Latest
    • Articles
    • Features
    • Most Read
    • News
    • News Releases
  • Topics
    • AI
    • Continuous Delivery
    • Continuous Testing
    • Cloud
    • Culture
    • DevSecOps
    • Enterprise DevOps
    • Leadership Suite
    • DevOps Practice
    • ROELBOB
    • DevOps Toolbox
    • IT as Code
  • Videos/Podcasts
    • DevOps Chats
    • DevOps Unbound
  • Webinars
    • Upcoming
    • On-Demand Webinars
  • Library
  • Events
    • Upcoming Events
    • On-Demand Events
  • Sponsored Communities
    • AWS Community Hub
    • CloudBees
    • IT as Code
    • Rocket on DevOps.com
    • Traceable on DevOps.com
    • Quali on DevOps.com
  • Related Sites
    • Techstrong Group
    • Container Journal
    • Security Boulevard
    • Techstrong Research
    • DevOps Chat
    • DevOps Dozen
    • DevOps TV
    • Digital Anarchist
  • Media Kit
  • About
  • AI
  • Cloud
  • Continuous Delivery
  • Continuous Testing
  • DevSecOps
  • DevOps Onramp
  • Practices
  • ROELBOB
  • Low-Code/No-Code
  • IT as Code
  • More
    • Application Performance Management/Monitoring
    • Culture
    • Enterprise DevOps

Home » Blogs » DevSecOps » Reducing Risk in Applications Using Docker Containers

Reducing Risk in Applications

Reducing Risk in Applications Using Docker Containers

By: Derek E. Weeks on May 2, 2018 1 Comment

Docker. It seems like in this day and age you are either using Docker containers or you are going to use Docker containers. If you haven’t jumped on the bandwagon yet, check out a previous article, “Docker: The New Ordinary.” If you are on the wagon or are thinking about it but have concerns about their security, it’s time to read on.

Recent Posts By Derek E. Weeks
  • State of the Software Supply Chain: Secure Coding Takes Spotlight
  • 200 Billion Downloads Can’t Be Wrong
  • Challenges in Leading a DevOps Team at a Fortune 100 Company
More from Derek E. Weeks
Related Posts
  • Reducing Risk in Applications Using Docker Containers
  • 9 Open Source DevOps Tools We Love
  • Creating Dev Environments With Docker Compose
    Related Categories
  • Blogs
  • Containers
  • DevOps Practice
  • DevSecOps
    Related Topics
  • all day devops
  • containers
  • docker
  • security
Show more
Show less

José Manuel Ortega (jmortega.github.io ) is a software engineer and security researcher in Spain. I recently watched his presentation online titled, “Testing Docker Images Security.” He gave an overview of typical Docker deployments, explained the attack surface and threats, presented how to detect vulnerabilities and outlined a couple of best practices. In short, his advice will help you learn how to better secure your Docker containers.

(New to Docker? Read this paragraph; all others skip ahead.)  If you aren’t sure what Docker is, José offered this explanation: “Docker containers wrap a piece of software in a complete file system that contains everything it needs to run: code, runtime, system tools, system libraries—anything you can install on a server, regardless of the environment it is running in.”

That is, containers are isolated but share an operating system and, where appropriate, binaries and libraries. Docker provides an additional layer of isolation, making your infrastructure safer by default. This makes the application life cycle faster and easier to configure, reducing risks in your applications.

For starters, José laid out Docker’s default mechanisms for security:

  • Linux kernel namespaces
  • Linux Control Groups (cgroups)
  • The Docker daemon
  • Linux capabilities (libcap)
  • Linux security mechanisms like AppArmor or SELinux

 

Screen Shot 2018-04-08 at 7.17.58 AM

José walked through others tools, add-ons, best practices, etc., to increase Docker container security. I will cover most of them here.

Docker Inspect Tool. The Docker Inspect Tool is built into Docker. It provides information about the host name, the ID of the image, etc. and it comes up when you start Docker.

Docker Content Trust. It protects against untrusted images. It can enable signing checks on every managed host, guarantee integrity of your images when pulled and provide trust from publisher to consumer.

Screen Shot 2018-04-08 at 7.19.01 AM

Docker File Security. Docker files build Docker containers. They should not write secrets, such as users and passwords. You should remove unnecessary setuid and setgid permissions, download packages securely using GPG and certificates, and try to restrict an image or container to one service.

Container Security. Docker security is about limiting and controlling the attack surface on the kernel. Don’t run your applications as root in containers, and create specific users for testing and policing the Docker image. Run filesystems as read-only so attackers can not overwrite data or save malicious scripts to the image.

José provided a useful checklist to check the security of a Docker container, but it’s not a short one. Remember, if you are going to deploy hundreds or thousands of these containers, you’ll want to ensure consistent handling of security concerns to keep the hackers at bay:

    • Do not write secrets to Docker files
    • Create a user
    • Follow version pinning for base images, packages, etc.
    • Remove unnecessary setuid, setgid permissions
    • Do not write any kind of update instructions alone in a Docker file
    • Download packages securely
    • Do not download unnecessary packages
    • Use COPY instead of ADD
    • Use the HEALTHCHECK command
    • Use gosu instead of sudo whenever possible
    • Use no-cache (if applicable) when building
    • Enable Docker Content Trust
    • Ensure images are free from known vulnerabilities
    • Ensure images are scanned frequently throughout your DevOps pipeline
    • Ensure your images, packages are up to date
    • Use file monitoring solutions for image layers (if required)

Auditing Docker Images. You can scan your images for known vulnerabilities with a wide variety of commercial and open source tools such as:

      • Docker’s native Security Scanning
      • Sonatype’s Nexus Lifecycle
      • Twistlock,
      • Docker Bench Security
      • CoreOS Clair
      • Dagda
      • Aqua
      • Tenable
      • Anchore

 

All of these solutions can be integrated in one element of your CI/CD pipelines — some can be integrated in multiple places.

José explored these solutions and best practices in more detail and offered up technical implementation tips in his full talk, available for free here. If you are working on or interested in Docker security, his talk is worth your time.

Thirsty for more DevOps discussions led by practitioners (not vendors)?  You too can binge watch 99 other talks from the All Day DevOps conference here.

— Derek E. Weeks

Filed Under: Blogs, Containers, DevOps Practice, DevSecOps Tagged With: all day devops, containers, docker, security

Sponsored Content
Featured eBook
DevOps: Mastering the Human Element

DevOps: Mastering the Human Element

While building constructive culture, engaging workers individually and helping staff avoid burnout have always been organizationally demanding, they are intensified by the continuous, always-on notion of DevOps.  When we think of work burnout, we often think of grueling workloads and deadline pressures. But it also has to do with mismatched ... Read More
« Code Delivery: Pipeline Automation for the Speed to Innovate
IT Revolution Announces Agenda For DevOps Enterprise Summit London 2018 »

TechStrong TV – Live

Click full-screen to enable volume control
Watch latest episodes and shows

Upcoming Webinars

10 steps to continuous performance testing in DevOps
Thursday, August 11, 2022 - 3:00 pm EDT
Bring Your Mission-Critical Data to Your Cloud Apps and Analytics
Tuesday, August 16, 2022 - 11:00 am EDT
Mistakes You Are Probably Making in Kubernetes
Tuesday, August 16, 2022 - 1:00 pm EDT

Latest from DevOps.com

Four Secure Coding Best Practices for Mobile Apps
August 11, 2022 | Jorge Damian
CloudNativeDay: WASM to Drive Next IT Epoch
August 10, 2022 | Mike Vizard
MLOps Vs. DevOps: What’s the Difference?
August 10, 2022 | Gilad David Maayan
GitHub Brings 2FA to JavaScript Package Manager
August 9, 2022 | Mike Vizard
CREST Defines Quality Verification Standard for AppSec Testing
August 9, 2022 | Mike Vizard

Get The Top Stories of the Week

  • View DevOps.com Privacy Policy
  • This field is for validation purposes and should be left unchanged.

Download Free eBook

The State of the CI/CD/ARA Market: Convergence
https://library.devops.com/the-state-of-the-ci/cd/ara-market

Most Read on DevOps.com

Recession! DevOps Hiring Freeze | Data Centers Suck (Power) ...
August 4, 2022 | Richi Jennings
Orgs Struggle to Get App Modernization Right
August 4, 2022 | Mike Vizard
GitHub Adds Tools to Simplify Management of Software Develop...
August 4, 2022 | Mike Vizard
The Everything-As-Code Revolution and the OWASP Top 10
August 4, 2022 | Aakash Shah
Putting the Security Into DevSecOps
August 5, 2022 | Ross Moore

On-Demand Webinars

DevOps.com Webinar ReplaysDevOps.com Webinar Replays
  • Home
  • About DevOps.com
  • Meet our Authors
  • Write for DevOps.com
  • Media Kit
  • Sponsor Info
  • Copyright
  • TOS
  • Privacy Policy

Powered by Techstrong Group, Inc.

© 2022 ·Techstrong Group, Inc.All rights reserved.