SlideShare a Scribd company logo
1 of 38
Getting Started With Docker
Why Containers?
● Isolation
○ Host OS
○ Other containers
● Resource limits
● Deployment
○ Container orchestration
○ Dependency management
● Portability
VMs vs Docker Containers
Host OS
Virtual Machine
Monitor
VM
Guest
OS ...
VM
Guest
OS
Base OS
...
Base OS
Host OS
Lifecycle
Dockerfile Run
Image
Container
Build
Push
Registry
Docker Image
Dockerfile
Parent Image
or
scratch
Dependencies
Code
Build
Image
Docker Image Layers
Layer
Layer
Layer
Layer
Manifest
● Layer IDs
● Size
● Digest
Docker Registry
● Image storage, delivery service
○ Local or remote
○ Repository
■ named images
■ (version) tags
○ default: hub.docker.com
Docker Registry
● docker pull registry[:port]/repository[:tag]
● docker push registry[:port]/repository[:tag]
Run
Image
Docker Container
Base OS
Container
Host OS
● docker container run 
--interactive 
--tty python:3.6
○ Dockerfile command:
CMD ["python3"]
Run Container (interactive)
Run Container (interactive)
GitHub Code Examples
https://github.com/a-y-khan/docker_examples
● docker image build --tag name[:tag] PATH | URL
○ Dockerfile with custom name (--file)
○ Build context (PATH | URL)
■ Build source, Dockerfile location
■ Get files from context
■ Size matters! (.dockerignore)
Build Image
● Build image from Python 3.6 parent
simple_python_docker
● docker image build --tag python3 .
○ builds python3:latest image
● docker container run python3:latest
simple_python_docker
● docker image history python3:latest
Image History
● docker image save --output python3_latest.tar 
python3:latest
Image Save, Load
● docker image load -input python3_latest.tar 
python3:latest
● ENTRYPOINT
○ Run specific executable
○ docker container run --entrypoint …
● CMD
○ Set default parameters, flags
○ docker container run python3:latest 
python –c “print(‘hello universe’)”
ENTRYPOINT vs CMD
flask_docker_logs
● Images, containers stateless
○ ephemeral filesystem storage
● Volume or bind mounting from host OS
○ persistent storage
○ separate stateless code from stateful
data
Docker State
● docker image build --tag app:1.0 .
flask_docker_logs
● docker volume create my_vol
● docker image ls
List Images, Volumes
● docker volume ls
● docker container run --name my_app 
--publish 5000:5000 
--rm --detach 
--mount 
source=my_vol,destination=/usr/app/logs 
app:1.0
flask_docker_logs
● docker container run --name my_app 
--publish 5000:5000 
--rm --detach 
--volume my_vol:/usr/app/logs 
app:1.0
Volume mount shorthand
● docker container run --name my_app 
--publish 5000:5000 
--rm --detach 
--cpus 1 --memory 250m 
--mount 
source=my_vol,destination=/usr/app/logs 
app:1.0
Limit Resources
● docker container run 
--name my_app_bind_mount 
--publish 5001:5000 
--rm --detach 
--volume $PWD/logs:/usr/app/logs 
app:1.0
Bind mount
● docker container ls (or docker container ps)
● docker container ls --all
○ Includes exited containers
List Running Containers
● docker container exec my_app 
ls –la /usr/app/logs
Docker Container Exec
● docker container exec 
--interactive --tty my_app 
python
Docker Container Exec
● docker image inspect app:1.0
Docker Image Inspect
● docker container inspect my_app
Docker Container Inspect
● docker volume inspect my_vol
Docker Volume Inspect
● docker system info
System Information
● docker system df
Docker System Disk Usage
● docker system df –verbose
● Disk usage by container, image, volume,
caches
● docker container stop my_app
○ Graceful exit with SIGTERM
○ SIGKILL after grace period
● docker container kill my_app
○ SIGKILL
● docker container rm my_app
● docker volume rm my_vol
Stop, Remove Containers, Volumes
● docker image rm app:1.0 python3:latest
● docker container prune
○ Remove stopped containers
● docker volume prune
○ Remove unused volumes
● docker system prune
○ Remove stopped containers, unused networks,
dangling images, caches
Docker Cleanup
● Exit container interactive shell
○ detach: CTRL-P, CTRL-Q
○ re-attach:
■ docker container attach my_app
○ stop: CTRL-D or CTRL-C or exit
Stop, Exit Containers
● Docker command line reference: https://dockr.ly/2DzkgBk
● Run as non-root user: https://bit.ly/2DpSyJw
● Multistage Dockerfile reference:
https://dockr.ly/2Mmy7Qt
● Play with Docker: https://bit.ly/2AXqewB
● Docker Deep Dive (Pluralsight): https://bit.ly/2khWfqt
More About Docker

More Related Content

What's hot

Practical Glusto Example
Practical Glusto ExamplePractical Glusto Example
Practical Glusto ExampleGluster.org
 
Start your container journey safely
Start your container journey safelyStart your container journey safely
Start your container journey safelyRachid Zarouali
 
CoreOS introduction - Johann Romefort
CoreOS introduction - Johann RomefortCoreOS introduction - Johann Romefort
CoreOS introduction - Johann RomefortStylight
 
Caching in Docker - the hardest thing in computer science
Caching in Docker - the hardest thing in computer scienceCaching in Docker - the hardest thing in computer science
Caching in Docker - the hardest thing in computer scienceJarek Potiuk
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructureSergiy Kukunin
 
Object Storage with Gluster
Object Storage with GlusterObject Storage with Gluster
Object Storage with GlusterGluster.org
 
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Binary Studio
 
Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014Pini Reznik
 
Containers: What are they, Really?
Containers: What are they, Really?Containers: What are they, Really?
Containers: What are they, Really?Sneha Inguva
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Binary Studio
 
Talk on PHP Day Uruguay about Docker
Talk on PHP Day Uruguay about DockerTalk on PHP Day Uruguay about Docker
Talk on PHP Day Uruguay about DockerWellington Silva
 
What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?Docker, Inc.
 
Collect distributed application logging using fluentd (EFK stack)
Collect distributed application logging using fluentd (EFK stack)Collect distributed application logging using fluentd (EFK stack)
Collect distributed application logging using fluentd (EFK stack)Marco Pas
 

What's hot (20)

Practical Glusto Example
Practical Glusto ExamplePractical Glusto Example
Practical Glusto Example
 
CoreOS Overview
CoreOS OverviewCoreOS Overview
CoreOS Overview
 
Start your container journey safely
Start your container journey safelyStart your container journey safely
Start your container journey safely
 
CoreOS Overview
CoreOS OverviewCoreOS Overview
CoreOS Overview
 
Rails in docker
Rails in dockerRails in docker
Rails in docker
 
Docker n co
Docker n coDocker n co
Docker n co
 
CoreOS introduction - Johann Romefort
CoreOS introduction - Johann RomefortCoreOS introduction - Johann Romefort
CoreOS introduction - Johann Romefort
 
Docker compose
Docker composeDocker compose
Docker compose
 
Caching in Docker - the hardest thing in computer science
Caching in Docker - the hardest thing in computer scienceCaching in Docker - the hardest thing in computer science
Caching in Docker - the hardest thing in computer science
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
 
From zero to Docker
From zero to DockerFrom zero to Docker
From zero to Docker
 
Object Storage with Gluster
Object Storage with GlusterObject Storage with Gluster
Object Storage with Gluster
 
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1
 
Docker 101
Docker 101Docker 101
Docker 101
 
Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014
 
Containers: What are they, Really?
Containers: What are they, Really?Containers: What are they, Really?
Containers: What are they, Really?
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4
 
Talk on PHP Day Uruguay about Docker
Talk on PHP Day Uruguay about DockerTalk on PHP Day Uruguay about Docker
Talk on PHP Day Uruguay about Docker
 
What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?
 
Collect distributed application logging using fluentd (EFK stack)
Collect distributed application logging using fluentd (EFK stack)Collect distributed application logging using fluentd (EFK stack)
Collect distributed application logging using fluentd (EFK stack)
 

Similar to Docker slides

Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxIgnacioTamayo2
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020CloudHero
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Bo-Yi Wu
 
Docker Up and Running Introduction
Docker Up and Running IntroductionDocker Up and Running Introduction
Docker Up and Running IntroductionMark Beacom
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017Paul Chao
 
The internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesThe internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesAkihiro Suda
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇Philip Zheng
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Ben Hall
 
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local BengaluruDeploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local BengaluruSwaminathan Vetri
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tipsSamuel Chow
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇Philip Zheng
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Paul Chao
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 
Be a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the tradeBe a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the tradeNicola Paolucci
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeDr. Ketan Parmar
 
Docker for developers z java
Docker for developers z javaDocker for developers z java
Docker for developers z javaandrzejsydor
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerGuido Schmutz
 

Similar to Docker slides (20)

Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Docker presentation
Docker presentationDocker presentation
Docker presentation
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
 
Docker Up and Running Introduction
Docker Up and Running IntroductionDocker Up and Running Introduction
Docker Up and Running Introduction
 
DockerCC.pdf
DockerCC.pdfDockerCC.pdf
DockerCC.pdf
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
The internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesThe internals and the latest trends of container runtimes
The internals and the latest trends of container runtimes
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local BengaluruDeploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
 
what is docker
what is dockerwhat is docker
what is docker
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Be a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the tradeBe a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the trade
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker Compose
 
Docker for developers z java
Docker for developers z javaDocker for developers z java
Docker for developers z java
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 

Recently uploaded

%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfryanfarris8
 
WSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid EnvironmentsWSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid EnvironmentsWSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2
 
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 

Recently uploaded (20)

%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
WSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid EnvironmentsWSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid Environments
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
 
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 

Docker slides

Editor's Notes

  1. Container: software tool for OS to run isolated processes with limits on resources processes can use Abstracts away the machine running software Container processes isolated from host OS processes Containers from same image also isolated from each other – independent! Declare and isolate dependencies Also set up dev environments quickly with containers (add databases, other services) Focus on Docker because most popular container standard IDEs offer live debugging in Docker (VS Code, PyCharm Pro etc.)
  2. VMM: create and run VMs with separate OS Divide host CPU, RAM, disk, total isolation! Docker engine layer allows container base OS to share host OS resources – lighter, much less overhead! Docker engine on MacOS and Windows uses virtualization system Also, docker on Mac and Windows (except on Windows Server 2016+) only as local dev environments! NOT FOR PRODUCTION!
  3. Build existing image (OS, other official Docker certified images!) pulled from local or known remote registry From scratch (special keyword) Image built to local registry Also upload to remote registry
  4. First part of lifecycle Dockerfile describes how the image is built Image is read-only, blueprint for creating the container at run time Image gets unique ID (SHA256 cryptographic hash) optionally name and tag (version etc)
  5. Image built from a stack of layers generated from Dockerfile commands (RUN, COPY, ADD which add or change files, env vars, CMD) and a manifest Layers are independent files, can be caches, each has ID (hash) Order matters!!! Digest is hash to verify image from registry (like checking MD5 sum) Caching layers matters!!! Viewing manifest is still experimental, won’t really talk about this...
  6. Registry contains repositories Docker Hub is default (no registry URL needed in default config), can set up registries in Google cloud, AWS etc. Repository example: collection of python images on DockerHub stored in python repo tagged by release numbers
  7. Can pull images from public or private registries Can push images to public or private registries Other commands can pull images (run!)
  8. Container is run-time instance of image Runs base OS with a command or executable set up in Dockerfile or set up command with Docker run
  9. Running official Python 3.6 docker image from Docker Hub If Python 3.6 image not local, pulls from Docker Hub Setting up a ”terminal” to interact with running container: flags typically used together to ensure IO attached Most flags have short form too! Command in image runs Python REPL with default settings
  10. See image layers pulled from registry Reports digest Work with interactive shell in container
  11. TODO: Slides linked in talk desc! Assume that the docker build context is the subdirectory containing code for the example!
  12. Tag flag is optional, can use image ID hash in run command too PATH is local dir URL can be Git repo, tar archive or plain text file see Docker docs for more info, not covering URL here dockerignore similar to git ignore, avoid bloat!
  13. 1st example! Docker has 2 ways of copying data into image: COPY best for local files, directories ADD best if remote URL or tar archive
  14. Default tag: latest, can use whatever Container run runs command in Dockerfile Not interactive this time!
  15. History of image we just built Missing image layer IDs from base python 3.6 image pulled from Docker Hub #nop: docker internal command (vs bash)
  16. Can export image and load elsewhere bypassing registry Also used for backups Best for dev and testing
  17. ENTRYPOINT and CMD set up docker container run something in container ENTRYPOINT is usually a single command, executable or script (bash scripts are common) In next example CMD is easier to override, can override without changing ENTRYPOINT Overriding our Dockerfile here Python parent image has null ENTRYPOINT
  18. Second example! Build super-simple Flask app that writes logs Binds to port 5000 in container Example of ENTRYPOINT and CMD together!
  19. Stateless unless connected persistent storage! Writing container data to a database or object store like S3 also works Better not to put too much data in image Bind mounts mount local filesystem files, directories Just covering volume mounts here
  20. Build: set tag version! Create volume to persist logs! Containers can share volumes!
  21. List local images Use image ID instead of name and tag! List running containers with name, command etc. Container ls alias = ps
  22. Use --publish to expose port to host (left is host, right is container always!), --rm to remove container on exit, --detach to run in background Without --mount, logs written only in running container and will disappear when container is removed mounted volume can be read-only --name: run container with alias, otherwise hash ID
  23. Shorthand with volume flag
  24. More memory and CPU limits in run CLI options Min memory is 4MB Container orchestration frameworks (Kubernetes) also do this
  25. Bind mount: mount local directory Doesn’t have to exist in either container or host Can also be read-only Note: new name, new host port
  26. List local images Use image ID instead of name and tag! List running containers with name, command etc. Container ls alias = ps Note random name for stopped python app
  27. Run one-off command in running container
  28. Interactive session in running container using same --interactive and --tty flags as run command Debugging!
  29. All the build-time data about the app:1.0 image Can also use Golang formatters to select output from inspect commands
  30. All the runtime data about the my_app container
  31. Shows mountpoint on local filesystem On Macs, need to access the VM Docker is running in Possible, but out of scope
  32. Overview of state of docker system about engine, running containers etc.
  33. Full information about disk usage by running and stopped containers Keeps info cached until system cache is pruned Note: Docker assigned random name to Python 3.6 container run earlier
  34. SIGTERM aka soft kill, can set timeout docker kill CLI can send signal other than SIGKILL (works like unix kill command) --signal flag
  35. Remove images -q: only image ids Can remove images by name
  36. CTRL-P, CTRL-Q leaves container running, can attach again Interactive: also use exit commands to stop container
  37. Play with Docker: Linux VM for experimenting with Docker containers