introducing docker - application containerization & service orchestration
TRANSCRIPT
![Page 1: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/1.jpg)
Introducing DockerApplication Containerization
&Service Orchestration
Sawood Alam <@ibnesayeed>
Old Dominion UniversityNorfolk, Virginia - 23529 (USA)
![Page 2: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/2.jpg)
Dockerizing ArchiveSpark
A 30 minutes of Pair Hacking made running a complex software as easy as:
$ docker run -p 8888:8888 ibnesayeed/archivespark
https://ws-dl.blogspot.com/2016/07/2016-07-21-dockerizing-archivespark.html
Read the full story at:
![Page 3: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/3.jpg)
Relatables
● The Magic Laptop problem● Wish, these researchers document their code● Cannot upgrade X to run Y because Z will break● This project is the spaghetti of a dozen different technologies● Yay! Got new machine :-) … Wait! I need to install & configure everything again ;-(● Too many VMs to manage
![Page 4: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/4.jpg)
What Is Docker?
● An application container● Packages dependencies● Isolates applications● Processes run on the host OS● Uses Linux cgroups and namespaces● Lighter than a virtual machine● Open-source
Host OS
Host OS
Docker Engine
Bins/Libs
App B
Bins/Libs
App A
Con
tain
er
![Page 5: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/5.jpg)
Dockerization Process
Dockerfile ImageBuild Run Container
![Page 6: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/6.jpg)
AUFS
file1 file2
file2
file3
file4
file1 file3
file1 file2 file3 file4 file5
Image Base Layer
Image Layer 1
Image Layer 2
Container Layer
More Layers ...
![Page 7: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/7.jpg)
Link Extractor Script
#!/usr/bin/env python
import sysimport requestsfrom bs4 import BeautifulSoup
res = requests.get(sys.argv[-1])soup = BeautifulSoup(res.text, "html.parser")for link in soup.find_all("a"): print(link.get("href"))
linkextractor.py
● Is it executable?● Is Python installed?● Are necessary libraries installed?● Can you install needed software?
![Page 8: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/8.jpg)
Dockerized Link Extractor Script
#!/usr/bin/env python
import sysimport requestsfrom bs4 import BeautifulSoup
res = requests.get(sys.argv[-1])soup = BeautifulSoup(res.text, "html.parser")for link in soup.find_all("a"): print(link.get("href"))
FROM pythonLABEL maintainer="Sawood Alam <@ibnesayeed>"
RUN pip install beautifulsoup4RUN pip install requestsCOPY linkextractor.py /app/WORKDIR /appRUN chmod a+x linkextractor.py
ENTRYPOINT ["./linkextractor.py"]
linkextractor.py Dockerfile
![Page 9: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/9.jpg)
Try It
me@thishost$ ls>> Dockerfile main.py# Build an image from the Dockerfile (change "ibnesayeed" with your Docker ID)me@thishost$ docker image build -t ibnesayeed/linkextractor .>> Layered docker image...# Run a container from the locally built imageme@thishost$ docker container run ibnesayeed/linkextractor https://odu.edu/>> Extracted links…# Push the image to the registryme@thishost$ docker image push ibnesayeed/linkextractor# Log in to a different hostme@thishost$ ssh you@otherhost# Run a container on the other host using the image in the registryyou@otherhost$ docker container run ibnesayeed/linkextractor https://example.com/>> Pull the image from the registry (if not cached already)>> Extracted links...
![Page 10: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/10.jpg)
Orchestration Demo
Web App
API Server
Live Web
Redis Cache
https://github.com/ibnesayeed/linkextractor
![Page 11: Introducing Docker - Application Containerization & Service Orchestration](https://reader035.vdocuments.us/reader035/viewer/2022071810/5a65092a7f8b9aa2548b617d/html5/thumbnails/11.jpg)
Useful Links
● https://github.com/ibnesayeed/linkextractor● https://docs.docker.com/● http://training.play-with-docker.com/● https://ws-dl.blogspot.com/● https://ws-dl.blogspot.com/2016/07/2016-07-21-dockerizing-archivespark.html
Sawood Alam <@ibnesayeed>