containers and virtualization tools ( docker )

28
containers and virtualization tools (Docker) Forloop/Abuja

Upload: imo-inyang

Post on 15-Apr-2017

90 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: containers and virtualization tools ( Docker )

containers and virtualization tools

(Docker)

Forloop/Abuja

Page 2: containers and virtualization tools ( Docker )

Imo InyangFull Stack Developer @ Reimnet

@imo_inyang on twitter

[email protected]

Page 3: containers and virtualization tools ( Docker )

virtualization refers to the act of creating a virtual (rather than actual) version of something, including virtual computer hardware platforms, operating systems, storage devices, and computer network resources.

What is Virtualization?

Page 4: containers and virtualization tools ( Docker )

VM – Virtual Machines –-Hypervisor and Vagrant

Containers–-Docker introduction ---Basic Setup and usage

Page 5: containers and virtualization tools ( Docker )

A VM is essentially an emulation of a real computer that executes programs like a real computer. VMs run on top of a physical machine using a “hypervisor”. A hypervisor, in turn, runs on either a host machine or on “bare-metal”.

Virtual Machines

Page 6: containers and virtualization tools ( Docker )

Virtual Machines

Page 7: containers and virtualization tools ( Docker )

A hypervisor is a software, firmware, or hardware that VMs run on top of. The hypervisors themselves run on physical computers, referred to as the “host machine”. The host machine provides the VMs with resources, including RAM and CPU. These resources are divided between VMs and can be distributed as you see fit.

hypervisor

Page 8: containers and virtualization tools ( Docker )

Type 1 hypervisor (also called a bare metal hypervisor) is installed directly on physical host server hardware just like an operating system. Type 1 hypervisors run on dedicated hardware. They require a management console and are used in data centers.

Examples Oracle OVM for SPARC, ESXi, Hyper-V and KVM.

Type 1 hypervisor

Page 9: containers and virtualization tools ( Docker )

hosted hypervisor, is a virtual machine manager that is installed as a software application on an existing operating system (OS).

ExamplesVMware Fusion, Oracle Virtual Box, Oracle VM for x86, Solaris Zones, Parallels and VMware Workstation

Type 2 hypervisor

Page 10: containers and virtualization tools ( Docker )

Unlike a VM which provides hardware virtualization, a container provides operating-system-level virtualization by abstracting the “user space”. You’ll see what I mean as we unpack the term container.

Containers

Page 11: containers and virtualization tools ( Docker )

Containers

Page 12: containers and virtualization tools ( Docker )

Containers share the host system’s kernel with other containers.

What is the Difference Containers and VMs?

Page 13: containers and virtualization tools ( Docker )

Docker is an open-source project based on Linux containers. It uses Linux Kernel features like namespaces and control groups to create containers on top of an operating system.

Docker

Page 14: containers and virtualization tools ( Docker )

Google has been using their own container technology for years. Others Linux container technologies include Solaris Zones, BSD jails, and LXC, which have been around for many years.

So why Docker?

Before Docker

Page 15: containers and virtualization tools ( Docker )

1. Ease of use: Docker has made it much easier for anyone—developers, systems admins,    architects and others—to take advantage of    containers in order to quickly build and test portable applications. The mantra is: “build once, run anywhere.”

Why Docker?

Page 16: containers and virtualization tools ( Docker )

2. Speed: Docker containers are very lightweight and fast. Since containers are just sandboxed environments running on the kernel, they take up fewer resources. You can create and run a Docker container in seconds, compared to VMs which might take longer because they have to boot up a full virtual operating system every time.

Why Docker?

Page 17: containers and virtualization tools ( Docker )

3. Docker Repository: Docker users also benefit from the increasingly rich ecosystem of Docker Hub, which you can think of as an “Github for Docker images.”

Docker Hub has tens of thousands of public images created by the community that are readily available for use. It’s incredibly easy to search for images that meet your needs, ready to pull down and use with little-to-no modification.

Why Docker?

Page 18: containers and virtualization tools ( Docker )

4. Modularity and Scalability: Docker makes it easy to break out your application’s functionality into individual containers.

This is needed in todays world of micro services

Why Docker?

Page 19: containers and virtualization tools ( Docker )

Concept of Docker

Page 20: containers and virtualization tools ( Docker )

Docker EngineDocker engine is the layer on which Docker runs. It’s a lightweight runtime and tooling that manages containers, images, builds, and more. It runs natively on Linux systems and is made up of:

1. A Docker Daemon that runs in the host computer.2. A Docker Client that then communicates with the Docker Daemon to execute commands.3. A REST API for interacting with the Docker Daemon remotely.

Concept of Docker

Page 21: containers and virtualization tools ( Docker )

Docker ImagesSimply the blueprint of a docker application

Docker Container This are real instances of an application Created from docker images

Docker DaemonBuild, run and distributes docker containers

Docker ClientDocker on our local mechine - Think of it as the UI for Docker.

Docker HubA repository for docker images ( github for docker)

Page 22: containers and virtualization tools ( Docker )

DockerfileA Dockerfile is where you write the instructions to build a Docker image. These instructions can be:RUN apt-get y install some-package: to install a software packageEXPOSE 8000: to expose a portENV ANT_HOME /usr/local/apache-ant to pass an environment variableand so forth. Once you’ve got your Dockerfile set up, you can use the docker build command to build an image from it. Here’s an example of a Dockerfile:

Page 23: containers and virtualization tools ( Docker )

Installing Docker

https://docs.docker.com/engine/installation/

Visit

Page 24: containers and virtualization tools ( Docker )

Docker Commands

Docker run <image>● Docker start <name | id >● Docker stop <name | id >docker ps – list all running containers

● Docker ps -a – include stopped containers

● Docker rm <name | id >. docker build – build docker image

● docker network inspect bridgeDocker Network information

Page 25: containers and virtualization tools ( Docker )

Test Commands

docker inspect {CID} | grep IPAddress | grep -v null| cut -d '"' -f 4 | head -1

Get docker container ip

docker build -t reimo/static-forloop . //build docker image

docker run -d --name forloop1 -p 8087:80 reimo/static-forloop //run docker image

Page 26: containers and virtualization tools ( Docker )

Running Docker Image

docker run reimo/forloopThe comend above will download and run reimo/forloop image from docker hub.

● Flags ● Docker accepts upto 4 or more flags per command Flags Value

--name Container name( your choice }

-d Null ( run container in the background )

-p Port ( external port to container port 8900:80 )

docker run --name forloophome -d -p 8900:80 reimo/forloop

Run with flags

Page 27: containers and virtualization tools ( Docker )

Resources

● https://docs.docker.com/● https://hub.docker.com/ - get docker images● Youtube ● Google is your friend on this one !

Page 28: containers and virtualization tools ( Docker )

End● Thanks for your time – hope it was worth it?● If you think I can help, reach me via

[email protected] or @imo_inyang on twitter