Forloop/Abuja
containers and virtualization tools (Docker)
Imo Inyang Full Stack Developer @ Reimnet @imo_inyang on twitter
[email protected]
What is Virtualization? virtualization refers to the act of creating a virtual (rather than actual) version of something inclu!ing virtual computer har!ware platforms operating systems storage !evices an! computer network resources.
VM – Virtual Machines –-Hypervisor and Vagrant
Containers –-Docker introduction ---asic !etup and usage
Virtual Machines " #$ is essentially an emulation of a real computer that e%ecutes programs like a real computer. #$s run on top of a physical machine using a &hypervisor'. " hypervisor in turn runs on either a host machine or on &aremetal'.
Virtual Machines
hypervisor " hypervisor is a software firmware or har!ware that #$s run on top of. *he hypervisors themselves run on physical computers referre! to as the &host machine'. *he host machine provi!es the #$s with resources inclu!ing R"$ an! +,-. *hese resources are !ivi!e! etween #$s an! can e !istriute! as you see fit.
$ype % hypervisor *ype hypervisor (also calle! a are metal hypervisor) is installe! !irectly on physical host server har!ware /ust like an operating system. *ype hypervisors run on !e!icate! har!ware. *hey re0uire a management console an! are use! in !ata centers.
"#amples 1racle 1#$ for S,"R+ 2S3i 4yper# an! 5#$.
$ype & hypervisor hoste! hypervisor is a virtual machine manager that is installe! as a software application on an e%isting operating system (1S).
"#amples #$ware Fusion 1racle #irtual 6o% 1racle #$ for %78 Solaris 9ones ,arallels an! #$ware :orkstation
Containers -nlike a #$ which provi!es har!ware virtualization a container provi!es operatingsystemlevel virtualization y astracting the &user space'. ;ou
Containers
What is the Di''erence Containers and VMs?
+ontainers share the host system
Docker Docker is an opensource pro/ect ase! on >inu% containers. =t uses >inu% 5ernel features like namespaces an! control groups to create containers on top of an operating system.
e'ore Docker ?oogle has een using their own container technology for years. 1thers >inu% container technologies inclu!e Solaris 9ones 6SD /ails an! >3+ which have een aroun! for many years.
!o (hy Docker?
Why Docker? %) "ase o' use* Docker has made it much easier 'or anyone+developers, systems admins, architects and others+ to take advantage o' containers in order to uickly .uild and test porta.le applications) $he mantra is* /.uild once, run any(here)0
Why Docker? &) !peed* Docker containers are very light(eight and 'ast) !ince containers are 1ust sand.o#ed environments running on the kernel, they take up 'e(er resources) 2ou can create and run a Docker container in seconds, compared to VMs (hich might take longer .ecause they have to .oot up a 'ull virtual operating system every time)
Why Docker? 3) Docker 4epository* Docker users also .ene'it 'rom the increasingly rich ecosystem o' Docker Hu., (hich you can think o' as an /5ithu. 'or Docker images)0 Docker Hu. has tens o' thousands o' pu.lic images created .y the community that are readily availa.le 'or use) It6s incredi.ly easy to search 'or images that meet your needs, ready to pull do(n and use (ith little-to-no modi'ication)
Why Docker?
7) Modularity and !cala.ility* Docker makes it easy to .reak out your application6s 'unctionality into individual containers) $his is needed in todays (orld o' micro services
Concept o' Docker
Concept o' Docker Docker "ngine Docker engine is the layer on (hich Docker runs) It6s a light(eight runtime and tooling that manages containers, images, .uilds, and more) It runs natively on 8inu# systems and is made up o'* %) 9 Docker Daemon that runs in the host computer) &) 9 Docker Client that then communicates (ith the Docker Daemon to e#ecute commands) 3) 9 4"!$ 9:I 'or interacting (ith the Docker Daemon remotely)
Docker Images Simply the lueprint of a !ocker application Docker Container *his are real instances of an application +reate! from !ocker images Docker Daemon 6uil! run an! !istriutes !ocker containers Docker Client Docker on our local mechine *hink of it as the -= for Docker. Docker Hu. " repository for !ocker images ( githu for !ocker)
Docker'ile " Dockerfile is where you write the instructions to uil! a Docker image. *hese instructions can e R-A aptget y install somepackage to install a software package 23,1S2 7BBB to e%pose a port 2A# "A*_41$2 CusrClocalCapacheant to pass an environment variale an! so forth. 1nce you
Installing Docker
Visit https*;;docs)docker)com;engin e;installation;
Docker Commands ●
●
●
●
Docker run
id = Docker stop id = docker ps – list all running containers Docker ps -a – include stopped containers Docker rm id =
) docker .uild – .uild docker image ●
docker net(ork inspect .ridge Docker Aetwork information
*est +omman!s docker inspect CID@ > grep I:9ddress > grep -v null> cut -d ABA -' 7 > head -% ?et !ocker container ip
docker .uild -t reimo;static-'orloop ) ;;.uild docker image docker run -d --name 'orloop% -p E* reimo;static'orloop ;;run docker image
4unning Docker Image
docker run reimo;'orloop *he comen! aove will !ownloa! an! run reimoCforloop image from !ocker hu. ●
●
Flags Docker accepts upto or more flags per comman!
Flags name
#alue +ontainer name( your choice E
!
Aull ( run container in the ackgroun! )
p
,ort ( e%ternal port to container
4un (ith 'lags
!ocker run name forloophome ! p 7BB7B reimoCforloop
Resources ●
httpsCC!ocs.!ocker.comC
●
httpsCChu.!ocker.comC get !ocker images
●
;outue
●
?oogle is your frien! on this one G
2n! ●
●
*hanks for your time H hope it was worth itI =f you think = can help reach me via [email protected] or @imo_inyang on twitter