Containers/Docker Mirna Alaisami Matthias Haeussler
What is a container? „in general“ 2
What is a Container? "in General" The term comes originally from the • transportation world! A shipping container is any • receptacle or enclosure for holding goods, so that it can be moved from one place to another without affecting its content. [2] 3
What problems do containers solve?
What Problems Do Containers Solve? Let's say that we want to ship some important documents and at • the same time a kind of liquid. How can we ship them together without having the danger that the liquid may ruin the documents? [3] [4] Simply open up two standardized shipping containers (that can • be handled the same anywhere in the world), load the documents in one of them and the liquid in the other, lock the containers, and ship them next to each other with isolating their content and protecting it from being damaged or lost, using any transportation mode ! 5
What Problems Do Containers Solve? [5] 6
What Problems Do Containers Solve? 7
What Problems Do Containers Solve? 8
What Problems Do Containers Solve? [6] 9
What Problems Do Containers Solve? [7] 10
What Problems Do Containers Solve? [8] 11
What is a container? "in IT world“
What is a Container? "in IT World" A software container is very similar • to a shipping container in its purpose! Here we simply package a piece of • software along with everything that is needed to make it work. More concretely, a software • container is an isolated working environment for an application , containing all the necessary dependencies, libraries, binaries and configurations needed for the application to run seamlessly. [9] 13
A container in technical words
A Container in Technical Words Technically, a container is a Linux process, or many processes, • which are running isolated from other processes on the system, using the chroot system call and some Linux kernel features such as cgroups and namespaces: − A chroot system call changes the root directory of a process and its children to a new location in the filesystem. − A namespace wraps the system objects (processes, networking, filesystems, and user ID components) in an abstraction that limits the visibility an object has on other objects. Thus, container processes are limited to see only what is in the same namespace. A cgroup (Control group) limits the usage of resources − (CPU, memory, disk, I/O) for a group of processes or containers. 15
Why do software containers exist?
Why Do Software Containers Exist? “ Dev ” “ Prod ” jar readme + Ops Dev App App Config DB Java EE Java EE [10] „App Server“ „App Server“ “ Lightweight ” Infrastructure Infrastructure ! DevOps Problem 17
Why Do Software Containers Exist? “ Dev ” “ Prod ” jar readme + Ops Dev App App Config DB Java EE Java EE [10] „App Server“ „App Server“ “ Lightweight ” Infrastructure Infrastructure “ Containers ” Container ☺ Container Engine Engine Node Node Node Node 18
Why Do Software Containers Exist? Abstraction • Isolation • Portability • Security • Agility • Disposability • Scalability • [11] 19
Containers vs. Container Images
Containers vs. Container Images Let us clarify the terminology before going more into details: • Container Container Image ▪ ▪ − Begin lifecycle using an image − Never started, never “running” − Running instance of an image − Blueprint of a container (Inert file, that’s the base on which you − Many containers can be run off instantiate containers ) the same image − Ensure reusability of containers App Runtime-dependency Run Container Image Containers 21
Containers vs. Container Images „immutable“ Image-name:v1 App JVM Ubuntu 22
Containers vs. Container Images ssh „immutable“ Image-name:v1 mkdir /tmp create file App App docker run JVM JVM Ubuntu Ubuntu Docker Daemon 23
Containers vs. Container Images ssh „immutable“ Image-name:v2 „immutable“ Image-name:v1 mkdir /tmp /tmp create file App App App docker run docker commit JVM JVM JVM Ubuntu Ubuntu Ubuntu Docker Daemon 24
Container technologies
Container Technologies chroot Process Containers, later: cgroups CF Warden, LMCTFY rkt, runC, Kubernetes Implementation of chroot system call in Implementation of cgroups in Linux- Container Runtimes of CloudFoundry / Competition with Docker with Unix V7 Kernel by Google Google e.g. rkt Enables separation of the file system for Limiting, accounting and isolating Slow increase in interest in containers Release of container tools like individual processes resource usage Kubernetes Google/LMCTFY concepts still used today 1979 2000-2005 2006 2008 2011-2013 2013 2013-2018 FreeBSD Jails, Linux VServer, Solaris Docker Container, OpenVZ Release of Docker Platform as open LXC Virtualization and isolation in source subsystems The first, most complete implementation Significant for the development of the of Linux container manager Required a lot of configuration and technology some kernel patches Implementation without Kernel-Patches Easy handling and management of A lot of Configuration containers Baseline for actual Runtimes 26
What is Docker?
What is Docker? A popular container with a broad • support from the cloud community but also commercially: − Linux-based docker ( based on cgroups and namespaces). − Windows-based docker ( cgroups and namespaces are represented differently). [17] 28
Why Docker?
Why Docker? Has the biggest and growing • community Provides the largest public repository • of container images(Docker Hub) Has clear and clean documentation • Is easy to use • Is an open source technology • Integrates with a number of • infrastructure tools [18] 30
Docker Hub
Docker Hub A cloud registry service that enables • storing and discovery of Docker images and automating workflows. Provides both public and private • repositories: Free for public images • Cost for private images • https://hub.docker.com • [19] 32
Docker engine components
Docker Engine Components Docker-Daemon: A persistent • background process (the dockerd command) that manages Docker images, containers, networks, and storage volumes. It constantly listens manages manages for Docker API requests and processes them (the dockerd command). A REST API: An API used by • applications to interact with the Docker manages manages daemon. It can be accessed by an HTTP client. Docker-Client: A command line • interface (CLI) client (the docker [21] command) for interacting with the Docker daemon. 34
How does Docker work?
How does Docker Work? Docker Client CLI [22] OR Remote API [23] 36
How does Docker Work? Docker Client Docker Host Docker Daemon CLI Containers Images OR Remote API 37
How does Docker Work? Docker Client Docker Host Docker Daemon CLI Containers Images OR Registry Remote API 38
How does Docker Work? Dowload Base Image (1) Build (1) Docker Client Docker Host (1) Dockerfile (1) Docker Daemon (1) CLI Containers Images OR Registry Remote API 39
How does Docker Work? Dowload Base Image (1) Build (1) Push (2) Docker Client Docker Host (1) Dockerfile (1) (2) Docker Daemon (1) CLI Containers Images OR Registry (2) Remote API 40
How does Docker Work? Dowload Base Image (1) Build (1) Get From Registry (3) Push (2) Not Found Locally? (3) Pull (3) Docker Client Docker Host (1) Dockerfile (1) (2) Docker Daemon (3) (3) (1) CLI Containers Images OR Registry (3) (2) Remote API 41
How does Docker Work? Dowload Base Image (1) Build (1) Get From Registry (3) Push (2) Not Found Locally? (3) Pull (3) „Start Container“ (4) Found Locally? (4) Run (4) Docker Client Docker Host (1) Dockerfile (1) (2) Docker Daemon (3) (3) (4) (1) CLI Containers Images (4) Registry OR (3) (4) (2) Remote API 42
Sources
Sources 1. https://regmedia.co.uk/2017/09/11/shutterstock_containers_in_port.jpg?x=1200&y=794 2. https://i.ytimg.com/vi/XbF-MBr0Vlk/maxresdefault.jpg 3. https://www.shareicon.net/document-file-documents-archive-interface-files-files-and-folders-817212 4. https://www.deviantart.com/thepow/art/Chemistry-Flasks-322657766 5. http://multiboxx.com/ 6. https://fr.pngtree.com/freepng/vector-maritime-transport_1639584.html 7. https://rfclipart.com/image/big/3f-89-52/cargo-container-train-with-diesel-locomotive-Download-Royalty-free- Vector-File-EPS-211474.jpg 8. https://previews.123rf.com/images/leshkasmok/leshkasmok1511/leshkasmok151100178/49155728-trasporto- aereo-di-concetto-di-trasporto-appartamento-stile-illustrazione-concetto-di-logistica-pu%C3%B2-ess.jpg 9. https://blog.risingstack.com/operating-system-containers-vs-application-containers/ 10. https://us.123rf.com/450wm/ylivdesign/ylivdesign1701/ylivdesign170101181/68586484-laptop-icon-isometric- 3d-style.jpg?ver=6 11. https://medium.com/tech-tajawal/devops-in-a-scaling-environment-9d5416ecb928 44
Recommend
More recommend