+ All Categories
Home > Documents > Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch...

Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch...

Date post: 31-Mar-2018
Category:
Upload: doduong
View: 228 times
Download: 0 times
Share this document with a friend
49
Dockah, Dockah, Dockah Presenter: Dan Walsh @rhatdan, Blog: danwalsh.livejournal.com, [email protected]
Transcript
Page 1: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

Dockah, Dockah, Dockah

Presenter: Dan Walsh

@rhatdan, Blog: danwalsh.livejournal.com,

[email protected]

Page 2: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

2

Evolution of The Operating SystemRHEL 4

HWHW

Host OS & Shared Services, Mgmt

App A App B App C

Host OS Userspace Runtime

Kernel & HW Drivers

Traditional Enterprise Operating System

Multiple Applications per machine + Single userspace runtime

Page 3: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

3

Evolution of Operating SystemRHEL 5 & RHEL 6

HWHW

Virt Host OS, Srvs, Mgmt

App A App B App C

Runtime A

Kernel & HW Drivers

Hypervisor

Guest Kernel A

GuestServices

Runtime B

Guest Kernel B

GuestServices

GuestServices

RuntimeC

Guest Kernel C

Virtualization & IaaS Cloud

Applications run inside a guest – full separation of host and guest

Page 4: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

4

Evolution of Operating SystemRHEL 7

Light-weight Application Isolation

Application runs inside a containerContainer deployed on bare metal or Virt/Cloud

Container Host OS & Central Shared Services

HWHW

MgmtContainers

ServiceContainers

App B

RuntimeB

App C

Runtime C

Kernel & HW Drivers

App A

RuntimeA Container Host OS &

Central Shared Services

Kernel & Virt Drivers

HWHW

Host OS

Kernel & HW Drivers

Hypervisor

MgmtContainers

ServiceContainers

App B

RuntimeB

App C

Runtime C

App A

RuntimeA

Page 5: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

5

The kernel knows SQUAT about CONTAINERS

Page 6: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

6

Containers are a userspace concept that takes advantage of several Kernel Subsystems

Page 7: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

7

Key elements of Linux Containers

Process Isolation

SecurityResource Management

Management

Page 8: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

8

Red Hat Enterprise LinuxContainer Architecture

Linux Kernel

Hardware (Intel, AMD)

Page 9: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

9

Red Hat Enterprise LinuxContainer Architecture

Linux Kernel

Hardware (Intel, AMD)

cgroups

Page 10: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

10

Cgroups

Cgroups

Memory

Network

Block IOCPU

Linux Kernel

Hardware (Intel, AMD)

Resource Management

Page 11: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

11

Red Hat Enterprise LinuxContainer Architecture

Linux Kernel

Hardware (Intel, AMD)

Cgroups Namespaces

Page 12: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

12

Namespaces

● Isolate processes

– Create a new environment with a

– Subset of the resources

● Once set up, namespaces are transparent for processes

● Can be used in custom and complex scenarios

● Supported Namespaces

– ipc, pid, mnt, net, uts

– Future Red Hat Enterprise Linux 7: user

Process Isolation

Page 13: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

13

Red Hat Enterprise LinuxContainer Architecture

Linux Kernel

Hardware (Intel, AMD)

Cgroups Namespaces Security

Page 14: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

14

Containers do NOT Contain!!!

Page 15: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

15

Security Isolation

● Linux Containerization not complete

– Not everything in Linux is namespaced

● SELinux sVirt

– Container tooling uses sVirt

• Type Enforcement

• MCS Separation

● Capabilities

● Future User Namespaces

Security

Page 16: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

16

Red Hat Enterprise LinuxContainer Architecture

Linux Kernel

Hardware (Intel, AMD)

Namespaces Cgroups Security

Docker

Drivers

Page 17: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

17

Red Hat Enterprise LinuxContainer Architecture

Linux Kernel

Hardware (Intel, AMD)

Cgroups Namespaces Security

Docker

Drivers

ContainersContainers

Page 18: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

18

Page 19: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

19

Intro to Docker

Page 20: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

20

Pre-1960 shipping industry

x

Page 21: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

21

Solution: Shipping container

Separation of concerns– User cares about packing the inside– Shipper cares about moving the container

Standardized interface

Page 22: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

22

Docker containers

Developer concernsCodeLibrariesServicesConfigurationData

All servers look the same

Ops concernsMoving containersStarting/Stopping containersLoggingMonitoringNetwork configuration

All containers look the same

Standardized interface for software container

Isolation

Page 23: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

23

Docker as a CLI for containers interesting but not that significant, we have had

container type technology since RHEL5.

Page 24: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

24

Docker as a packaging tool for shipping software may be a game changer.

Page 25: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

25

Docker glossary

● Image

– Read-only template for a container

– Includes all files required for application to run

– Has additional metadata

• Exposed network ports

• Binary to start

Page 26: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

26

Docker glossary

● Container

– Running processes

– Based on a particular image

– Typically a single process

– Isolated from host system

– Cheap

– Can write to filesystem

– Commit creates new Image

Page 27: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

27

Docker glossary

Layers

– Images are based on a parent

– The layers stack on top

– Files in base layers are shared between Images

– Each commit creates a layer

– Base image has no parent

Page 28: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

28

Docker 101

● Hello, World!     $> docker run rhel7 echo “Hello, World!”

● Fetch an image

     $> docker pull rhel6

● List images     $> docker images

Page 29: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

29

Dockerfile

● Simple instructions

● Feels like scripting   FROM rhel7

   RUN yum install ­y mongodb­server && mkdir ­p /data/db

   EXPOSE 27017

   VOLUME [“/data/db”]

   CMD “mongod”

● Easy to make an image

     $> docker build ­t MY_MONGO .

Page 30: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

30

Dockerfile● Scott Collier 

rpm -q fedora-dockerfiles -l| grep /Dockerfile

/usr/share/fedora-dockerfiles/apache/Dockerfile

/usr/share/fedora-dockerfiles/couchdb/Dockerfile

/usr/share/fedora-dockerfiles/firefox/Dockerfile

/usr/share/fedora-dockerfiles/memcached/Dockerfile

/usr/share/fedora-dockerfiles/mongodb/Dockerfile

/usr/share/fedora-dockerfiles/mysql/Dockerfile

/usr/share/fedora-dockerfiles/nginx/Dockerfile

/usr/share/fedora-dockerfiles/nodejs/Dockerfile

/usr/share/fedora-dockerfiles/postgres/Dockerfile

/usr/share/fedora-dockerfiles/rabbitmq/Dockerfile

/usr/share/fedora-dockerfiles/ssh/Dockerfile

Page 31: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

31

Red Hat Enhancements of docker

http://www.theregister.co.uk/2014/03/11/red_hat_docker_linux/

Page 32: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

32

Who remembers Linux prior to Red Hat Enterprise Linux?

Page 33: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

33

Linux 1999

Page 34: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

34

Go to yahoo.com or AltaVista.com and google it?

Page 35: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

35

I found it on rpmfind.net, download and install.

Page 36: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

36

Hey I hear there is a big Security vulnerability in Zlib.

Page 37: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

37

How many copies do you have on your system???

Page 38: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

Bundling: Static Builds vs Shared Libraries

● A large part of the application developers dilemma:

– What is part of the app and what is part of the dependency layer provided by OS?

– What features can we depend on from the OS vs what should be “vendored” into the app?

● Shared Libraries:

– RHEL and Linux in general depend on the use of shared libraries to ease security and feature updates

● Static Builds:

– Vendors like to include (static link) as much as possible, but it leaves them open to vulnerabilities in unpatched code.

Page 39: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

39

Who you gonna trust?

Page 41: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

41

Red Hat Images

● RHEL6 and RHEL7 base images

● Potentially RHEL5 Base image?

● Packaged images?

– httpd?,mariadb?, postgresql? FreeIPA?

● Layered Product Images

– Jboss? Gluster? Openstack? ...

Page 42: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

42

Red Hat Certified Images

● Partner Images

– Third Party packagers

– Build layered images on top of RHEL base images.

The Red Hat Container Certification ensures that application containers built using Red Hat Enterprise Linux will operate seamlessly across certified container hosts.

Page 43: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

43

Docker == Static Builds

● Docker bundles userspace.

– What happens when a Docker APP has a CVE?

– You want to avoid application base image sprawl

– Red Hat will update images with latest fixes

– Customer apps will get fixes via subscription

● Customer apps based on RHEL images need simple rebuild.

– docker build myapp

Page 44: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

44

Systemd integration with Docker

● Manage application containers same as services

– Docker container applications started on demand

– Socket Activation

– Cgroup Integration

● Journald logging

– Stdout/stderr of container automatically logged to host.

– Syslog messages automatically logged to host.

Page 45: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

45

Systemd Cgroup Configuration passed to Docker

systemd

Docker

httpd

httpd_container.serviceExecStart: docker start rhel7/httpdMemLimit 500k

cgroup configured

500k

Page 46: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

46

Systemd Socket Activation of Docker Containers

systemd

httpd_container.serviceExecStart: docker start rhel7/httpd[socket]ListenStream=80

80

Page 47: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

47

Systemd Socket Activation of Docker Containers

systemd

Docker

httpd

httpd_container.serviceExecStart: docker start rhel7/httpd[socket]ListenStream=80

80

80

Page 48: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

48

RHEL Security Integration

● Update RHEL images on CVE

– Security response team

● SELinux integration

– Containers will automatically be labeled based on sVirt

● libseccomp

● Auditing

– Proper auditing of container events

• Start/Stop

Page 49: Dockah, Dockah, Dockah - People 101 Hello, World! $> docker run rhel7 echo “Hello, World!” Fetch an image $> docker pull rhel6 List images $> docker images 29 Dockerfile Simple

Thank-you!


Recommended