SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Containers 101
• An overview of why containers are so hot today
• How containers work
• Pitfalls in container development
Session Details
Quick review: Virtual machines
Operating
System
User Space
Ring 2Ring 2
Ring 1Ring 1
Kernel
User Space
Ring 2Ring 2
Ring 1Ring 1
Kernel
Hypervisor
User Space
Ring 2Ring 2
Ring 1Ring 1
Kernel
Real mode Protected mode Virtualization extensions
Container – Something which uses “Docker” to encapsulate a service
• Need not be Docker. Alternatives are CoreOS rkt and Open Container Initiative
Microservice – A service designed to perform a single task
• Think smallest unit of usable work to scale
Cloud Native Design – A paradigm where enterprise resiliency principles do not
apply (more on that later)
Pet – A term referring to a long lived service in an enterprise
• Pets are cared for, and typically loved, nurtured and evolve
Cattle – A term referring to a service whose welfare is not a priority
• The concept being that cattle are replaceable – sorry animal lovers
Container Vernacular
1. Containers are immutable
• Create once, run many instances
1. Containers are ephemeral
• A containers’ life should be only as long as absolutely required
1. Containers can be sacrificed
• Orchestration systems may terminate a container if needed
• No guarantee of lifespan
• Don’t store data or logs in containers
1. Containers limit resource access
• Define cgroups for CPU/RAM access
• Avoid use of ROOT credentials
• Layered file system helps manage storage
Container Rules – Cloud Native Designs
Docker 1.10 and and later
What is a Container?
Linux Containers
Linux kernel
namespaces cgroupscgroups
SELinux/AppArmorSELinux/AppArmor
liblxc
Linux kernel
namespaces cgroupscgroups
SELinux/AppArmorSELinux/AppArmor
Docker EngineDocker Engine
runC
containerdcontainerd
runC runC
containerd-shim containerd-shim containerd-shim
Application containers
• Hold a single application
• Can follow micro-services design pattern
• Starting point for most container usage
• Short lifespan, many per host
System containers
• Proxy for a VM
• Insulate against core operating system
• Perfect for legacy apps
• Long lifespan, few per host
Container Use Cases
KernelKernel
KernelKernel
Container Deployments Continue to Grow
Container Concepts
• Representation of an application
• Built from a “Dockerfile”
• Uses a layered file system
• Single process per application
• Created in a Docker engine
• Appears as local binary repository
• Stored in a binary repository known as a Registry
Container Image
• Where container images are stored outside of local engine
• Core commands
• docker tag  puts a mutable tag on the image
• docker push  uploads an image to the registry
• docker pull  downloads an image from the registry
• docker.io is default (aka Docker Hub is “predefined” as trusted
• Be explicit about image source, and validate
Container Registry
Container Image Build Process
Registry
Git
Binary Sources
myimage:1.0.1
FROM centos:centos7
MAINTAINER Black Duck Hub Team
RUN yum -y update-minimal --security --sec-severity=Important --sec-severity=Critical --setopt=tsflags=nodocs && yum
clean all && chmod -x /bin/sh
ARG bds_ver
ARG LASTCOMMIT
ARG BUILDTIME
ARG BUILD
ENV APP_HOME=/scan.cli-${bds_ver}
ENV PATH=${APP_HOME}/bin:${JAVA_HOME}/bin:${PATH}
COPY ./output/ose_scanner /ose_scanner
COPY ./hub_scanner/scan.cli/scan.cli-${bds_ver} /scan.cli-${bds_ver}
COPY ./LICENSE /LICENSE
COPY ./LICENSE /licenses/
COPY ./help.1 /help.1
LABEL name="Black Duck OpsSight for OpenShift Scanner"
ENTRYPOINT [ "/ose_scanner" ]
EXPOSE 9036
How Images are Created – Core Components of a
Dockerfile
How Images are Created – Docker Engine Cache
How Images are Created – Image Layer History
How Images are Created – Image Layer Cache Impacts
Build
• Where does your base image actually come from?
• What is the health of that base image?
• You’re updating it at build time, but from what cache?
• You trust your build servers, but who controls them?
• Who has rights to modify container images?
• What happens if base image registry goes away?
• What happens if base image tag goes away?
• What happens if an update mirror goes down?
• How do I patch container images?
Container Trust Issues
Image Health is Critical to Image Security
Docker Hub Container Scanning Red Hat Container Catalog Health Index
Objective: Share data between container and outside world
Core commands
• docker volume create  create the volume
• docker run myimage –v source:/data  map source to /data within container
Supported drivers
• local, tmpfs, btrfs, nfs  represent mounted filesystems on host
Use in Dockerfile
Docker Volume Management
Modifies build image - Wrong
FROM centos:centos7
VOLUME /data
RUN touch /data/x
Modifies data in built image - Correct
FROM centos:centos7
RUN mkdir /data && touch /data/x
VOLUME /data
Secrets are…
• Application encryption keys
• Access tokens
• Credentials
Secrets are managed by…
• Environment variables – small installations and developer scenarios
• JSON Web Tokens (JWT)
• Docker Compose in Swarm mode (Compose V3)
• External secret services (HashiCorp Vault, Keywhiz, Consul, Amazon KMS, etc)
Secret Management in Containers
Registry
Binary Sources
Patching Containers – A/B Testing with Rebuild
Git
docker run myimage -ti
• Runs a new interactive instance of container image `myimage` with default entry point
docker run myimage –ti /usr/bin/sh
• Runs a new interactive instance of container image `myimage` opening a shell
docker attach name
• Attaches to running instance of container named `name`
docker exec name –ti /usr/bin/sh
• Attaches to running instance of container named `name` and opens a shell
docker logs myimage --follow
• Attaches to running instance of container named `name` opening and following stdout
Container Debugging
Securing the Container
Contents and
Environment
Deployment Requirements – Trust Your Container Source
Minimal HostMinimal Host
RedHat Container
Catalog
Docker Hub Third Party and Custom
Problem: Who to trust, and why?
• Trusted source?
• Unexpected image contents
• Locked application layer
versions (e.g. no yum update)
• Layer dependencies
(monolithic vs micro-services)
• Validated when?
• Trusted platform
• Signed by whom?
• Docker default network is Linux Bridge
• Access policy defined in iptables
• Based on Docker daemon startup
• External communication on by default
• -- iptables=off to disable iptables modification
• Inter container communication on by default
• -- icc=false to disable inter container communication
• -- link=CONTAINER_NAME_or_ID:ALIAS with EXPOSE ports from Docker file
• All inter-container/cross host communication is external
• `docker network` command simplifies aspects of network design
• Create user defined networks, including overlay networks
• docker network create --driver bridge sql
Deployment – Define Sensible Network Policies
Docker Networking - Example
Host
eth0/10.204.136.1eth0/10.204.136.1
veth0veth0
veth1veth1
veth2veth2
veth3veth3
veth4veth4
veth5veth5
docker0
NAT/ 172.16.1.0/24NAT/ 172.16.1.0/24
iptablesiptables
Host
docker0
eth0/10.204.136.2eth0/10.204.136.2
veth0veth0
veth1veth1
veth2veth2
veth3veth3
veth4veth4
veth5veth5
NAT/ 172.16.1.0/24NAT/ 172.16.1.0/24
iptablesiptables
• Enable Linux Security Modules
• SELinux
• --selinux-enabled on Docker engine, --security-opt=“label:profile”
• AppArmor
• -- security-opt=“apparmor:profile”
• Apply Linux kernel security profiles
• grsecurity, PaX and seccomp protections for ALSR and RBAC
• Adjust privileged kernel capabilities
• Reduce capabilities with --cap-drop
• Beware –cap-add and –privileged=false, and CAP_SYS_ADMIN
• Use a minimal Linux Host OS
• Red Hat Linux Atomic Host, Container Linux, RancherOS
• Reduce impact of noisy neighbors
• Use cgroups to set CPU shares and memory
Secure the Host and Namespaces
Control
Domain
NetworkingNetworkingComputeCompute StorageStorage
Hypervisor
Container
VM
Minimal OS
Layer Container Security to Protect Against Attacks
Container
VM
Minimal OS
Control
Domain
NetworkingNetworkingComputeCompute StorageStorage
Hypervisor
Container
VM
Minimal OS
Layer Container Security to Protect Against Attacks
Container
VM
Minimal OS
Container VM
Minimal OS
Containers 101

Weitere ähnliche Inhalte

Was ist angesagt?

Linux Container Technology 101
Linux Container Technology 101Linux Container Technology 101
Linux Container Technology 101
inside-BigData.com
 
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Simplilearn
 

Was ist angesagt? (20)

DevOps with Kubernetes
DevOps with KubernetesDevOps with Kubernetes
DevOps with Kubernetes
 
Dockers and containers basics
Dockers and containers basicsDockers and containers basics
Dockers and containers basics
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Introduction to Docker storage, volume and image
Introduction to Docker storage, volume and imageIntroduction to Docker storage, volume and image
Introduction to Docker storage, volume and image
 
Docker and the Linux Kernel
Docker and the Linux KernelDocker and the Linux Kernel
Docker and the Linux Kernel
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Containerization & Docker - Under the Hood
Containerization & Docker - Under the HoodContainerization & Docker - Under the Hood
Containerization & Docker - Under the Hood
 
Jenkins.pdf
Jenkins.pdfJenkins.pdf
Jenkins.pdf
 
Linux Container Technology 101
Linux Container Technology 101Linux Container Technology 101
Linux Container Technology 101
 
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Containerization
ContainerizationContainerization
Containerization
 
Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 

Ähnlich wie Containers 101

CONTAINERIZATION WITH DOCKER .pptx
CONTAINERIZATION WITH DOCKER .pptxCONTAINERIZATION WITH DOCKER .pptx
CONTAINERIZATION WITH DOCKER .pptx
SanjuGamesphere
 
IBM Bluemix Paris Meetup #14 - Le Village by CA - 20160413 - Introduction à D...
IBM Bluemix Paris Meetup #14 - Le Village by CA - 20160413 - Introduction à D...IBM Bluemix Paris Meetup #14 - Le Village by CA - 20160413 - Introduction à D...
IBM Bluemix Paris Meetup #14 - Le Village by CA - 20160413 - Introduction à D...
IBM France Lab
 
Docker - Portable Deployment
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deployment
javaonfly
 

Ähnlich wie Containers 101 (20)

Docker
DockerDocker
Docker
 
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
 
Containers docker-docker hub-azureacr-azure aci
Containers docker-docker hub-azureacr-azure aciContainers docker-docker hub-azureacr-azure aci
Containers docker-docker hub-azureacr-azure aci
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
 
1. Docker Introduction.pdf
1. Docker Introduction.pdf1. Docker Introduction.pdf
1. Docker Introduction.pdf
 
Preparing your dockerised application for production deployment
Preparing your dockerised application for production deploymentPreparing your dockerised application for production deployment
Preparing your dockerised application for production deployment
 
CONTAINERIZATION WITH DOCKER .pptx
CONTAINERIZATION WITH DOCKER .pptxCONTAINERIZATION WITH DOCKER .pptx
CONTAINERIZATION WITH DOCKER .pptx
 
IBM Bluemix Paris Meetup #14 - Le Village by CA - 20160413 - Introduction à D...
IBM Bluemix Paris Meetup #14 - Le Village by CA - 20160413 - Introduction à D...IBM Bluemix Paris Meetup #14 - Le Village by CA - 20160413 - Introduction à D...
IBM Bluemix Paris Meetup #14 - Le Village by CA - 20160413 - Introduction à D...
 
You, and Me, and Docker Makes Three
You, and Me, and Docker Makes ThreeYou, and Me, and Docker Makes Three
You, and Me, and Docker Makes Three
 
Docker.pptx
Docker.pptxDocker.pptx
Docker.pptx
 
Docker - Portable Deployment
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deployment
 
5 Ways to Secure Your Containers for Docker and Beyond
5 Ways to Secure Your Containers for Docker and Beyond5 Ways to Secure Your Containers for Docker and Beyond
5 Ways to Secure Your Containers for Docker and Beyond
 
AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)
 
AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)
 
Using Docker in production: Get started today!
Using Docker in production: Get started today!Using Docker in production: Get started today!
Using Docker in production: Get started today!
 
DCSF19 Container Security: Theory & Practice at Netflix
DCSF19 Container Security: Theory & Practice at NetflixDCSF19 Container Security: Theory & Practice at Netflix
DCSF19 Container Security: Theory & Practice at Netflix
 
Introduction to container based virtualization with docker
Introduction to container based virtualization with dockerIntroduction to container based virtualization with docker
Introduction to container based virtualization with docker
 
컨테이너 기술 소개 - Warden, Garden, Docker
컨테이너 기술 소개 - Warden, Garden, Docker컨테이너 기술 소개 - Warden, Garden, Docker
컨테이너 기술 소개 - Warden, Garden, Docker
 
Docker Container Security
Docker Container SecurityDocker Container Security
Docker Container Security
 
Developer workflow with docker
Developer workflow with dockerDeveloper workflow with docker
Developer workflow with docker
 

Mehr von Black Duck by Synopsys

Mehr von Black Duck by Synopsys (20)

Flight WEST 2018 Presentation - A Buyer Investor Playbook for Successfully Na...
Flight WEST 2018 Presentation - A Buyer Investor Playbook for Successfully Na...Flight WEST 2018 Presentation - A Buyer Investor Playbook for Successfully Na...
Flight WEST 2018 Presentation - A Buyer Investor Playbook for Successfully Na...
 
FLIGHT WEST 2018 Presentation - Continuous Monitoring of Open Source Componen...
FLIGHT WEST 2018 Presentation - Continuous Monitoring of Open Source Componen...FLIGHT WEST 2018 Presentation - Continuous Monitoring of Open Source Componen...
FLIGHT WEST 2018 Presentation - Continuous Monitoring of Open Source Componen...
 
FLIGHT WEST 2018 Presentation - Open Source License Management in Black Duck Hub
FLIGHT WEST 2018 Presentation - Open Source License Management in Black Duck HubFLIGHT WEST 2018 Presentation - Open Source License Management in Black Duck Hub
FLIGHT WEST 2018 Presentation - Open Source License Management in Black Duck Hub
 
FLIGHT WEST 2018 - Presentation - SCA 101: How to Manage Open Source Security...
FLIGHT WEST 2018 - Presentation - SCA 101: How to Manage Open Source Security...FLIGHT WEST 2018 - Presentation - SCA 101: How to Manage Open Source Security...
FLIGHT WEST 2018 - Presentation - SCA 101: How to Manage Open Source Security...
 
FLIGHT WEST 2018 Presentation - Integrating Security into Your Development an...
FLIGHT WEST 2018 Presentation - Integrating Security into Your Development an...FLIGHT WEST 2018 Presentation - Integrating Security into Your Development an...
FLIGHT WEST 2018 Presentation - Integrating Security into Your Development an...
 
Open-Source- Sicherheits- und Risikoanalyse 2018
Open-Source- Sicherheits- und Risikoanalyse 2018Open-Source- Sicherheits- und Risikoanalyse 2018
Open-Source- Sicherheits- und Risikoanalyse 2018
 
FLIGHT Amsterdam Presentation - Open Source, IP and Trade Secrets: An Impossi...
FLIGHT Amsterdam Presentation - Open Source, IP and Trade Secrets: An Impossi...FLIGHT Amsterdam Presentation - Open Source, IP and Trade Secrets: An Impossi...
FLIGHT Amsterdam Presentation - Open Source, IP and Trade Secrets: An Impossi...
 
FLIGHT Amsterdam Presentation - Data Breaches and the Law: A Practical Guide
FLIGHT Amsterdam Presentation - Data Breaches and the Law: A Practical GuideFLIGHT Amsterdam Presentation - Data Breaches and the Law: A Practical Guide
FLIGHT Amsterdam Presentation - Data Breaches and the Law: A Practical Guide
 
FLIGHT Amsterdam Presentation - Don’t Let Open Source Software Kill Your Deal
FLIGHT Amsterdam Presentation - Don’t Let Open Source Software Kill Your DealFLIGHT Amsterdam Presentation - Don’t Let Open Source Software Kill Your Deal
FLIGHT Amsterdam Presentation - Don’t Let Open Source Software Kill Your Deal
 
FLIGHT Amsterdam Presentation - Open Source License Management in the Black D...
FLIGHT Amsterdam Presentation - Open Source License Management in the Black D...FLIGHT Amsterdam Presentation - Open Source License Management in the Black D...
FLIGHT Amsterdam Presentation - Open Source License Management in the Black D...
 
FLIGHT Amsterdam Presentation - From Protex to Hub
FLIGHT Amsterdam Presentation - From Protex to Hub FLIGHT Amsterdam Presentation - From Protex to Hub
FLIGHT Amsterdam Presentation - From Protex to Hub
 
Open Source Insight: Securing IoT, Atlanta Ransomware Attack, Congress on Cyb...
Open Source Insight: Securing IoT, Atlanta Ransomware Attack, Congress on Cyb...Open Source Insight: Securing IoT, Atlanta Ransomware Attack, Congress on Cyb...
Open Source Insight: Securing IoT, Atlanta Ransomware Attack, Congress on Cyb...
 
Open Source Insight: GitHub Finds 4M Flaws, IAST Magic Quadrant, 2018 Open So...
Open Source Insight:GitHub Finds 4M Flaws, IAST Magic Quadrant, 2018 Open So...Open Source Insight:GitHub Finds 4M Flaws, IAST Magic Quadrant, 2018 Open So...
Open Source Insight: GitHub Finds 4M Flaws, IAST Magic Quadrant, 2018 Open So...
 
Open Source Rookies and Community
Open Source Rookies and CommunityOpen Source Rookies and Community
Open Source Rookies and Community
 
Open Source Insight: Who Owns Linux? TRITON Attack, App Security Testing, Fut...
Open Source Insight: Who Owns Linux? TRITON Attack, App Security Testing, Fut...Open Source Insight: Who Owns Linux? TRITON Attack, App Security Testing, Fut...
Open Source Insight: Who Owns Linux? TRITON Attack, App Security Testing, Fut...
 
Open Source Insight: SCA for DevOps, DHS Security, Securing Open Source for G...
Open Source Insight: SCA for DevOps, DHS Security, Securing Open Source for G...Open Source Insight: SCA for DevOps, DHS Security, Securing Open Source for G...
Open Source Insight: SCA for DevOps, DHS Security, Securing Open Source for G...
 
Open Source Insight: AppSec for DevOps, Open Source vs Proprietary, Malicious...
Open Source Insight: AppSec for DevOps, Open Source vs Proprietary, Malicious...Open Source Insight: AppSec for DevOps, Open Source vs Proprietary, Malicious...
Open Source Insight: AppSec for DevOps, Open Source vs Proprietary, Malicious...
 
Open Source Insight: Big Data Breaches, Costly Cyberattacks, Vuln Detection f...
Open Source Insight: Big Data Breaches, Costly Cyberattacks, Vuln Detection f...Open Source Insight: Big Data Breaches, Costly Cyberattacks, Vuln Detection f...
Open Source Insight: Big Data Breaches, Costly Cyberattacks, Vuln Detection f...
 
Open Source Insight: Happy Birthday Open Source and Application Security for ...
Open Source Insight: Happy Birthday Open Source and Application Security for ...Open Source Insight: Happy Birthday Open Source and Application Security for ...
Open Source Insight: Happy Birthday Open Source and Application Security for ...
 
Open Source Insight: Security Breaches and Cryptocurrency Dominating News
Open Source Insight: Security Breaches and Cryptocurrency Dominating NewsOpen Source Insight: Security Breaches and Cryptocurrency Dominating News
Open Source Insight: Security Breaches and Cryptocurrency Dominating News
 

Kürzlich hochgeladen

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Containers 101

  • 2. • An overview of why containers are so hot today • How containers work • Pitfalls in container development Session Details
  • 3. Quick review: Virtual machines Operating System User Space Ring 2Ring 2 Ring 1Ring 1 Kernel User Space Ring 2Ring 2 Ring 1Ring 1 Kernel Hypervisor User Space Ring 2Ring 2 Ring 1Ring 1 Kernel Real mode Protected mode Virtualization extensions
  • 4. Container – Something which uses “Docker” to encapsulate a service • Need not be Docker. Alternatives are CoreOS rkt and Open Container Initiative Microservice – A service designed to perform a single task • Think smallest unit of usable work to scale Cloud Native Design – A paradigm where enterprise resiliency principles do not apply (more on that later) Pet – A term referring to a long lived service in an enterprise • Pets are cared for, and typically loved, nurtured and evolve Cattle – A term referring to a service whose welfare is not a priority • The concept being that cattle are replaceable – sorry animal lovers Container Vernacular
  • 5. 1. Containers are immutable • Create once, run many instances 1. Containers are ephemeral • A containers’ life should be only as long as absolutely required 1. Containers can be sacrificed • Orchestration systems may terminate a container if needed • No guarantee of lifespan • Don’t store data or logs in containers 1. Containers limit resource access • Define cgroups for CPU/RAM access • Avoid use of ROOT credentials • Layered file system helps manage storage Container Rules – Cloud Native Designs
  • 6. Docker 1.10 and and later What is a Container? Linux Containers Linux kernel namespaces cgroupscgroups SELinux/AppArmorSELinux/AppArmor liblxc Linux kernel namespaces cgroupscgroups SELinux/AppArmorSELinux/AppArmor Docker EngineDocker Engine runC containerdcontainerd runC runC containerd-shim containerd-shim containerd-shim
  • 7. Application containers • Hold a single application • Can follow micro-services design pattern • Starting point for most container usage • Short lifespan, many per host System containers • Proxy for a VM • Insulate against core operating system • Perfect for legacy apps • Long lifespan, few per host Container Use Cases KernelKernel KernelKernel
  • 10. • Representation of an application • Built from a “Dockerfile” • Uses a layered file system • Single process per application • Created in a Docker engine • Appears as local binary repository • Stored in a binary repository known as a Registry Container Image
  • 11. • Where container images are stored outside of local engine • Core commands • docker tag  puts a mutable tag on the image • docker push  uploads an image to the registry • docker pull  downloads an image from the registry • docker.io is default (aka Docker Hub is “predefined” as trusted • Be explicit about image source, and validate Container Registry
  • 12. Container Image Build Process Registry Git Binary Sources myimage:1.0.1
  • 13. FROM centos:centos7 MAINTAINER Black Duck Hub Team RUN yum -y update-minimal --security --sec-severity=Important --sec-severity=Critical --setopt=tsflags=nodocs && yum clean all && chmod -x /bin/sh ARG bds_ver ARG LASTCOMMIT ARG BUILDTIME ARG BUILD ENV APP_HOME=/scan.cli-${bds_ver} ENV PATH=${APP_HOME}/bin:${JAVA_HOME}/bin:${PATH} COPY ./output/ose_scanner /ose_scanner COPY ./hub_scanner/scan.cli/scan.cli-${bds_ver} /scan.cli-${bds_ver} COPY ./LICENSE /LICENSE COPY ./LICENSE /licenses/ COPY ./help.1 /help.1 LABEL name="Black Duck OpsSight for OpenShift Scanner" ENTRYPOINT [ "/ose_scanner" ] EXPOSE 9036 How Images are Created – Core Components of a Dockerfile
  • 14. How Images are Created – Docker Engine Cache
  • 15. How Images are Created – Image Layer History
  • 16. How Images are Created – Image Layer Cache Impacts Build
  • 17. • Where does your base image actually come from? • What is the health of that base image? • You’re updating it at build time, but from what cache? • You trust your build servers, but who controls them? • Who has rights to modify container images? • What happens if base image registry goes away? • What happens if base image tag goes away? • What happens if an update mirror goes down? • How do I patch container images? Container Trust Issues
  • 18. Image Health is Critical to Image Security Docker Hub Container Scanning Red Hat Container Catalog Health Index
  • 19. Objective: Share data between container and outside world Core commands • docker volume create  create the volume • docker run myimage –v source:/data  map source to /data within container Supported drivers • local, tmpfs, btrfs, nfs  represent mounted filesystems on host Use in Dockerfile Docker Volume Management Modifies build image - Wrong FROM centos:centos7 VOLUME /data RUN touch /data/x Modifies data in built image - Correct FROM centos:centos7 RUN mkdir /data && touch /data/x VOLUME /data
  • 20. Secrets are… • Application encryption keys • Access tokens • Credentials Secrets are managed by… • Environment variables – small installations and developer scenarios • JSON Web Tokens (JWT) • Docker Compose in Swarm mode (Compose V3) • External secret services (HashiCorp Vault, Keywhiz, Consul, Amazon KMS, etc) Secret Management in Containers
  • 21. Registry Binary Sources Patching Containers – A/B Testing with Rebuild Git
  • 22. docker run myimage -ti • Runs a new interactive instance of container image `myimage` with default entry point docker run myimage –ti /usr/bin/sh • Runs a new interactive instance of container image `myimage` opening a shell docker attach name • Attaches to running instance of container named `name` docker exec name –ti /usr/bin/sh • Attaches to running instance of container named `name` and opens a shell docker logs myimage --follow • Attaches to running instance of container named `name` opening and following stdout Container Debugging
  • 24. Deployment Requirements – Trust Your Container Source Minimal HostMinimal Host RedHat Container Catalog Docker Hub Third Party and Custom Problem: Who to trust, and why? • Trusted source? • Unexpected image contents • Locked application layer versions (e.g. no yum update) • Layer dependencies (monolithic vs micro-services) • Validated when? • Trusted platform • Signed by whom?
  • 25. • Docker default network is Linux Bridge • Access policy defined in iptables • Based on Docker daemon startup • External communication on by default • -- iptables=off to disable iptables modification • Inter container communication on by default • -- icc=false to disable inter container communication • -- link=CONTAINER_NAME_or_ID:ALIAS with EXPOSE ports from Docker file • All inter-container/cross host communication is external • `docker network` command simplifies aspects of network design • Create user defined networks, including overlay networks • docker network create --driver bridge sql Deployment – Define Sensible Network Policies
  • 26. Docker Networking - Example Host eth0/10.204.136.1eth0/10.204.136.1 veth0veth0 veth1veth1 veth2veth2 veth3veth3 veth4veth4 veth5veth5 docker0 NAT/ 172.16.1.0/24NAT/ 172.16.1.0/24 iptablesiptables Host docker0 eth0/10.204.136.2eth0/10.204.136.2 veth0veth0 veth1veth1 veth2veth2 veth3veth3 veth4veth4 veth5veth5 NAT/ 172.16.1.0/24NAT/ 172.16.1.0/24 iptablesiptables
  • 27. • Enable Linux Security Modules • SELinux • --selinux-enabled on Docker engine, --security-opt=“label:profile” • AppArmor • -- security-opt=“apparmor:profile” • Apply Linux kernel security profiles • grsecurity, PaX and seccomp protections for ALSR and RBAC • Adjust privileged kernel capabilities • Reduce capabilities with --cap-drop • Beware –cap-add and –privileged=false, and CAP_SYS_ADMIN • Use a minimal Linux Host OS • Red Hat Linux Atomic Host, Container Linux, RancherOS • Reduce impact of noisy neighbors • Use cgroups to set CPU shares and memory Secure the Host and Namespaces
  • 28. Control Domain NetworkingNetworkingComputeCompute StorageStorage Hypervisor Container VM Minimal OS Layer Container Security to Protect Against Attacks Container VM Minimal OS
  • 29. Control Domain NetworkingNetworkingComputeCompute StorageStorage Hypervisor Container VM Minimal OS Layer Container Security to Protect Against Attacks Container VM Minimal OS Container VM Minimal OS

Hinweis der Redaktion

  1. https://docs.docker.com/engine/userguide/networking/default_network/container-communication/
  2. If you assume from the outset your containers will be compromised, what would you do differently? What could you do to make life much harder to mount an attack from a compromised container? The first item everyone should have on their list is to enable the SELinux and AppArmor security modules for the distro you’re using as a base. For SELinux, you specify that it’s enabled on the command line for Docker Engine, and then on the container you specify a security option representing the profile you want to use. Now that you have some security modules in place, you’re in better shape, but you can still make it much harder to mount a proper attack. Consider for example an attacker who recognizes they’re in a container, and assumes that means there probably are multiple containers with the same profile. Armed with that knowledge, one of the easiest ways to make the life of an attacker harder is to randomize the memory load location. That’s where kernel security profiles come into play. Grsecurity, PaX and seccomp enable roles based access and address randomization upon load capabilities. Net of this, where the executable code lives in memory changes, and that makes it harder to know if you’ve created a viable attack or not. Now the Docker people have done a great job over the years in locking down the level of privileged access you get from within a container. In part, this is done using what’s known as kernel capabilities. Kernel capabilities offer a granular level of control over the types of operations you want the kernel to perform. Consistent with the concept of least privilege, you don’t want to ask for more rights than you need. If you find the defaults are providing more access than your application requires, you can pare things back using the –cap-drop option. Of course, it’s entirely possible you might need more rights, but if you find you need to disable priviledged access, or want to set the CAP_SYS_ADMIN flag, beware you’re effectively giving the container the equivalent of root access. Lastly, from a security perspective, you can choose to use a minimal Linux distro such as Atomic or CoreOS, but you still will want to pay attention to the options I’ve just outlined. So now that you’ve limited the access a potential attacker has to system services, you still have to contend with other types of havoc. A perfect example of this is the concept of a noisy neighbor. Most of us have had the experience of having someone in a neighboring space behave in an annoying manner. In the case of computing, the annoying neighbor can be one which consumes excessive memory or processing time. Limiting the scope of interference is very easy. All you need to do is define some CPU shares and memory limits for the container and set them during launch.