Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn OpenShift

You're reading from   Learn OpenShift Deploy, build, manage, and migrate applications with OpenShift Origin 3.9

Arrow left icon
Product type Paperback
Published in Jul 2018
Publisher Packt
ISBN-13 9781788992329
Length 504 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (3):
Arrow left icon
Denis Zuev Denis Zuev
Author Profile Icon Denis Zuev
Denis Zuev
Aleksey Usov Aleksey Usov
Author Profile Icon Aleksey Usov
Aleksey Usov
Artemii Kropachev Artemii Kropachev
Author Profile Icon Artemii Kropachev
Artemii Kropachev
Arrow right icon
View More author details
Toc

Table of Contents (24) Chapters Close

Preface 1. Containers and Docker Overview FREE CHAPTER 2. Kubernetes Overview 3. CRI-O Overview 4. OpenShift Overview 5. Building an OpenShift Lab 6. OpenShift Installation 7. Managing Persistent Storage 8. Core OpenShift Concepts 9. Advanced OpenShift Concepts 10. Security in OpenShift 11. Managing OpenShift Networking 12. Deploying Simple Applications in OpenShift 13. Deploying Multi-Tier Applications Using Templates 14. Building Application Images from Dockerfile 15. Building PHP Applications from Source Code 16. Building a Multi-Tier Application from Source Code 17. CI/CD Pipelines in OpenShift 18. OpenShift HA Architecture Overview 19. OpenShift HA Design for Single and Multiple DCs 20. Network Design for OpenShift HA 21. What is New in OpenShift 3.9? 22. Assessments 23. Other Books You May Enjoy

Understanding Docker images and layers

A Docker image is a read-only template used to build containers. An image consists of a number of layers that are combined into a single virtual filesystem accessible for Docker applications. This is achieved by using a special technique which combines multiple layers into a single view. Docker images are immutable, but you can add an extra layer and save them as a new image. Basically, you can add or change the Docker image content without changing these images directly. Docker images are the main way to ship, store, and deliver containerized applications. Containers are created using Docker images; if you do not have a Docker image, you need to download or build one.

Container filesystem

The container filesystem, used for every Docker image, is represented as a list of read-only layers stacked on top of each other. These layers eventually form a base root filesystem for a container. In order to make it happen, different storage drivers are being used. All the changes to the filesystem of a running container are done to the top level image layer of a container. This layer is called a Container layer. What it basically means is that several containers may share access to the same underlying level of a Docker image, but write the changes locally and uniquely to each other. This process is shown in the following diagram:

Docker layers

Docker storage drivers

A Docker storage driver is the main component to enable and manage container images. Two main technologies are used for that—copy-on-write and stackable image layers. The storage driver is designed to handle the details of these layers so that they interact with each other. There are several drivers available. They do pretty much the same job, but each and every one of them does it differently. The most common storage drivers are AUFS, Overlay/Overlay2, Devicemapper, Btrfs, and ZFS. All storage drivers can be categorized into three different types:

Storage driver category

Storage drivers

Union filesystems

AUFS, Overlay, Overlay2

Snapshotting filesystems

Btrfs, ZFS

Copy-on-write block devices

Devicemapper

Container image layers

As previously mentioned, a Docker image contains a number of layers that are combined into a single filesystem using a storage driver. The layers (also called intermediate images) are generated when commands are executed during the Docker image build process. Usually, Docker images are created using a Dockerfile, the syntax of which will be described later. Each layer represents an instruction in the image's Dockerfile.

Each layer, except the very last one, is read-only:

Docker image layers

A Docker image usually consists of several layers, stacked one on top of the other. The top layer has read-write permissions, and all the remaining layers have read-only permissions. This concept is very similar to the copy-on-write technology. So, when you run a container from the image, all the changes are done to this top writable layer.

You have been reading a chapter from
Learn OpenShift
Published in: Jul 2018
Publisher: Packt
ISBN-13: 9781788992329
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime