Containers Flashcards
What are the benefits of Virtualisation in cloud computing?
- Server Consolidation
- Isolation
- Resource Management
- Security
What are some drawbacks of Virtualisation?
- Highly resource intensive
- Slow to start
- Tricky to create and manage
Why do we use containers instead of VMs?
Lightweight alternative
-starts almost instantainiously
-less resource intensive
-easier to create
What are Containers
Designed to encapsulate an applivation and its dependancies
Sits on top of the kernal of a Host OS
Feel like VMs, but are much more light weight - (The code is actualy just running on the OS but just shielded from the rest of the OS with some ‘smoke’ and ‘mirrors’.
EXAMPLE CONTAINERS: Docker, PodMan, Kubernates, OpenShift.
What is a Dockerfile
A script containing instructions on how to build a Docker image.
How would you create and run a doker image from a dockerfile.
Dockerfile name: Dockerfile
Example:docker build -t hello-world .
- This will build an image called hello-world-t
is used to specify a name and optionally a tag in the name:tag
format.
at the end specifies to use the current directory,docker run hello-world
- this will run the docker container
What are the elements of a Dockerfile?
- Base Image (What image to base the build on)
- Instructions (Steps to build the image e.g. Install dependancies,copping files, config envirnoment)
- Commands
- Expose ports
- Entrypoints (Comand for when a container is started)
How is the Linux Kernal used in containerisation?
The Linux kernal plays a crutial role in enabling containertisation through: Namespaces:
these isolate process groups, providing each conatiner with its own view of the System resources, such as network, processes and mount points.
Control Groups (cgroups):
these manage resource allocation and usage for containers, ensuring fair resource distribution (e.g. a container can’t hog all the memory and CPU)
Union File System:
These allow containers to share a read-only base file system while maintaining separate writeable layers