SlideShare a Scribd company logo
1 of 17
MySQL
Docker Containerization
©2020 Shrenik Parekh. All rights reserved.
1
2
©2020 Shrenik Parekh. All rights reserved.
Docker Introduction
● Container can be installed on Bare-metal, Physical / Virtual Machine,
Cloud instance
● Host could be Windows, Linux or Mac OS X
● Docker image run as a single process
● Docker images are available on Docker
One image can fire many containers
● Package an application with all dependencies
● Lightweight virtual machine
● Doesn’t require operating system
● Linux kernel libraries shared with containers
● Each container runs specific task
3
©2020 Shrenik Parekh. All rights reserved.
Docker Network
Docker Network drivers: Pluggable,
● Bridge – Default, used when application runs in standalone
mode
● Host – For standalone container, no network isolation between
container and docker host, use host network directly
● Overlay – Multi host networking
● Macvlam -
● Third party Network Plugins
Ref.:
https://docs.docker.com/network/
https://www.docker.com/blog/understanding-docker-networking-drivers-use-cases/
4
©2020 Shrenik Parekh. All rights reserved.
Bridge Network
● Default, simple to use, simple to troubleshoot, good choice for
developer
● The bridge driver is a local scope driver, it only provides
service discovery, IPAM (IP address management), and
connectivity on a single host
● Creates private network internal to the host
● External access granted by exposing ports
● Secures the network by managing rules that block connectivity
between different Docker networks
● Docker Engine creates the necessary Linux bridges, internal
interfaces, iptables rules
● Host routes to make this connectivity possible
5
©2020 Shrenik Parekh. All rights reserved.
Bridge Network
6
©2020 Shrenik Parekh. All rights reserved.
Bridge Network
Ref.: https://medium.com/@jamesemyn/basic-docker-networking-9130ab889359
7
©2020 Shrenik Parekh. All rights reserved.
Create Bridge Network
Create Docker bridge mybridge:
$docker network create -d bridge mybridge
Run Docker container db:
$docker run -d --net mybridge --name db redis
Run docker container web:
$docker run -d --net mybridge -e DB=db -p 8000:5000 --
name web chrch/web
8
©2020 Shrenik Parekh. All rights reserved.
Host Network
● For standalone container
● No network isolation between container and docker host
● Use host network directly
● Container does not get its own IP-address allocated
● port-mapping does not take effect if you specify
● The -p, --publish, -P, and --publish-all option are ignored, and
produce warning
● Host mode networking can be useful to optimize performance, and in
situations where a container needs to handle a large range of ports,
as it does not require network address translation (NAT), and no
“userland-proxy” is created for each port
● The host networking driver only works on Linux hosts
● Not supported on Docker Desktop for Mac, Docker Desktop for
Windows, or Docker EE for Windows Server
9
©2020 Shrenik Parekh. All rights reserved.
Host Network
Ref.: https://medium.com/@jamesemyn/basic-docker-networking-9130ab889359
10
©2020 Shrenik Parekh. All rights reserved.
Overlay Network
● Built in, multi host networking, swarm scope driver
● Operates across an entire Swarm or UCP cluster
● IPAM, service discovery, multi-host connectivity, encryption,
and load balancing are built right in
● Driver utilizes an industry-standard VXLAN data plane that
decouples the container network from the underlying physical
network (the underlay).
● Network policy, visibility, and security is controlled centrally
through the Docker Universal Control Plane (UCP).
11
©2020 Shrenik Parekh. All rights reserved.
Overlay Network
Ref.: https://www.docker.com/blog/understanding-docker-networking-drivers-use-cases/
12
©2020 Shrenik Parekh. All rights reserved.
MySQL Docker Container
Common commands use for MySQL running in container
Find Docker Version:
# docker –v
List Docker Container:
# docker ps –a
Fetch MySQL logs:
# docker logs <container_name> 2>&1 | grep GENERATED
Connect MySQL:
#docker exec -it <container_name> mysql -uroot -p
13
©2020 Shrenik Parekh. All rights reserved.
MySQL Docker Container
Connect MySQL file system in Docker:
#docker exec -it <container_name> bash
Backup MySQL databases using mysqldump:
# docker exec [MYSQL_CONTAINER] /usr/bin/mysqldump 
-u [MYSQL_USER] --password=[MYSQL_PASSWORD] 
--all-databases > backup.sql
Restore MySQL databases:
# cat backup.sql | docker exec -i [MYSQL_CONTAINER]
/usr/bin/mysql -u [MYSQL_USER] --password=[MYSQL_PASSWORD]
[MYSQL_DATABASE]
14
©2020 Shrenik Parekh. All rights reserved.
Master Slave Replication - Same Host
Ref.: http://khmel.org/docker-containers-with-mysql-master-slave-replication.html
15
©2020 Shrenik Parekh. All rights reserved.
Master Slave Replication - Different Host
16
©2020 Shrenik Parekh. All rights reserved.
Persistent MySQL Docker Container
17
©2020 Shrenik Parekh. All rights reserved.
Backup MySQL Database in Container
https://storageswiss.com/2016/05/19/backing-up-
databases-in-docker-containers/

More Related Content

What's hot

[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020Akihiro Suda
 
Docker Security - Continuous Container Security
Docker Security - Continuous Container SecurityDocker Security - Continuous Container Security
Docker Security - Continuous Container SecurityDieter Reuter
 
OpenNebulaConf 2016 - Networking, NFVs and SDNs Hands-on Workshop by Rubén S....
OpenNebulaConf 2016 - Networking, NFVs and SDNs Hands-on Workshop by Rubén S....OpenNebulaConf 2016 - Networking, NFVs and SDNs Hands-on Workshop by Rubén S....
OpenNebulaConf 2016 - Networking, NFVs and SDNs Hands-on Workshop by Rubén S....OpenNebula Project
 
Usernetes: Kubernetes as a non-root user
Usernetes: Kubernetes as a non-root userUsernetes: Kubernetes as a non-root user
Usernetes: Kubernetes as a non-root userAkihiro Suda
 
The State of Rootless Containers
The State of Rootless ContainersThe State of Rootless Containers
The State of Rootless ContainersAkihiro Suda
 
Go 1.8 'new' networking features
Go 1.8 'new' networking featuresGo 1.8 'new' networking features
Go 1.8 'new' networking featuresstrikr .
 
[DockerCon 2020] Hardening Docker daemon with Rootless Mode
[DockerCon 2020] Hardening Docker daemon with Rootless Mode[DockerCon 2020] Hardening Docker daemon with Rootless Mode
[DockerCon 2020] Hardening Docker daemon with Rootless ModeAkihiro Suda
 
Rootless Containers & Unresolved issues
Rootless Containers & Unresolved issuesRootless Containers & Unresolved issues
Rootless Containers & Unresolved issuesAkihiro Suda
 
Kubernetes, Terraform, Vault, and Consul
Kubernetes, Terraform, Vault, and ConsulKubernetes, Terraform, Vault, and Consul
Kubernetes, Terraform, Vault, and ConsulCloudOps2005
 
Comparing Next-Generation Container Image Building Tools
 Comparing Next-Generation Container Image Building Tools Comparing Next-Generation Container Image Building Tools
Comparing Next-Generation Container Image Building ToolsAkihiro Suda
 
OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...
OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...
OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...Cloud Native Day Tel Aviv
 
Kuryr & Fuxi: OpenStack networking and storage for Docker Swarm containers
Kuryr & Fuxi: OpenStack networking and storage for Docker Swarm containersKuryr & Fuxi: OpenStack networking and storage for Docker Swarm containers
Kuryr & Fuxi: OpenStack networking and storage for Docker Swarm containersAntoni Segura Puimedon
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday developmentJustyna Ilczuk
 
pkgsrc on SmartOS
pkgsrc on SmartOSpkgsrc on SmartOS
pkgsrc on SmartOSjonperkin
 
Libcontainer: joining forces under one roof
Libcontainer: joining forces under one roofLibcontainer: joining forces under one roof
Libcontainer: joining forces under one roofAndrey Vagin
 
GStreamer support in WebKit. what’s new?
GStreamer support in WebKit. what’s new?GStreamer support in WebKit. what’s new?
GStreamer support in WebKit. what’s new?philn2
 

What's hot (20)

[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020
 
Docker. General overview
Docker. General overviewDocker. General overview
Docker. General overview
 
Docker Security - Continuous Container Security
Docker Security - Continuous Container SecurityDocker Security - Continuous Container Security
Docker Security - Continuous Container Security
 
OpenNebulaConf 2016 - Networking, NFVs and SDNs Hands-on Workshop by Rubén S....
OpenNebulaConf 2016 - Networking, NFVs and SDNs Hands-on Workshop by Rubén S....OpenNebulaConf 2016 - Networking, NFVs and SDNs Hands-on Workshop by Rubén S....
OpenNebulaConf 2016 - Networking, NFVs and SDNs Hands-on Workshop by Rubén S....
 
Usernetes: Kubernetes as a non-root user
Usernetes: Kubernetes as a non-root userUsernetes: Kubernetes as a non-root user
Usernetes: Kubernetes as a non-root user
 
OpenDaylight OpenStack Integration
OpenDaylight OpenStack IntegrationOpenDaylight OpenStack Integration
OpenDaylight OpenStack Integration
 
The State of Rootless Containers
The State of Rootless ContainersThe State of Rootless Containers
The State of Rootless Containers
 
Go 1.8 'new' networking features
Go 1.8 'new' networking featuresGo 1.8 'new' networking features
Go 1.8 'new' networking features
 
[DockerCon 2020] Hardening Docker daemon with Rootless Mode
[DockerCon 2020] Hardening Docker daemon with Rootless Mode[DockerCon 2020] Hardening Docker daemon with Rootless Mode
[DockerCon 2020] Hardening Docker daemon with Rootless Mode
 
Rootless Containers & Unresolved issues
Rootless Containers & Unresolved issuesRootless Containers & Unresolved issues
Rootless Containers & Unresolved issues
 
Kubernetes, Terraform, Vault, and Consul
Kubernetes, Terraform, Vault, and ConsulKubernetes, Terraform, Vault, and Consul
Kubernetes, Terraform, Vault, and Consul
 
Comparing Next-Generation Container Image Building Tools
 Comparing Next-Generation Container Image Building Tools Comparing Next-Generation Container Image Building Tools
Comparing Next-Generation Container Image Building Tools
 
OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...
OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...
OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...
 
Docker at Flux7
Docker at Flux7Docker at Flux7
Docker at Flux7
 
Kuryr & Fuxi: OpenStack networking and storage for Docker Swarm containers
Kuryr & Fuxi: OpenStack networking and storage for Docker Swarm containersKuryr & Fuxi: OpenStack networking and storage for Docker Swarm containers
Kuryr & Fuxi: OpenStack networking and storage for Docker Swarm containers
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
pkgsrc on SmartOS
pkgsrc on SmartOSpkgsrc on SmartOS
pkgsrc on SmartOS
 
Libcontainer: joining forces under one roof
Libcontainer: joining forces under one roofLibcontainer: joining forces under one roof
Libcontainer: joining forces under one roof
 
GStreamer support in WebKit. what’s new?
GStreamer support in WebKit. what’s new?GStreamer support in WebKit. what’s new?
GStreamer support in WebKit. what’s new?
 
ISC HPCW talks
ISC HPCW talksISC HPCW talks
ISC HPCW talks
 

Similar to MySQL | My SQL docker containerization | Docker Network

Docker Networking Overview
Docker Networking OverviewDocker Networking Overview
Docker Networking OverviewSreenivas Makam
 
Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesSreenivas Makam
 
Docker meetup
Docker meetupDocker meetup
Docker meetupsyed1
 
Docker on Power Systems
Docker on Power SystemsDocker on Power Systems
Docker on Power SystemsCesar Maciel
 
Conatiner Networking with MidoNet
Conatiner Networking with MidoNetConatiner Networking with MidoNet
Conatiner Networking with MidoNetMidokuraUSA
 
Managing multicast/igmp stream on Docker
Managing multicast/igmp stream on DockerManaging multicast/igmp stream on Docker
Managing multicast/igmp stream on DockerThierry Gayet
 
Deploying Microservice on Docker
Deploying Microservice on DockerDeploying Microservice on Docker
Deploying Microservice on DockerKnoldus Inc.
 
ContainerDays Boston 2016: "Docker For the Developer" (Borja Burgos)
ContainerDays Boston 2016: "Docker For the Developer" (Borja Burgos)ContainerDays Boston 2016: "Docker For the Developer" (Borja Burgos)
ContainerDays Boston 2016: "Docker For the Developer" (Borja Burgos)DynamicInfraDays
 
Practical Design Patterns in Docker Networking
Practical Design Patterns in Docker NetworkingPractical Design Patterns in Docker Networking
Practical Design Patterns in Docker NetworkingDocker, Inc.
 
Running .NET on Docker
Running .NET on DockerRunning .NET on Docker
Running .NET on DockerBen Hall
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peekmsyukor
 
Oracle Database 18c Docker.pdf
Oracle Database 18c Docker.pdfOracle Database 18c Docker.pdf
Oracle Database 18c Docker.pdfYossi Nixon
 
Network Design patters with Docker
Network Design patters with DockerNetwork Design patters with Docker
Network Design patters with DockerDaniel Finneran
 
Clustering Docker with Docker Swarm on openSUSE
Clustering Docker with Docker Swarm on openSUSEClustering Docker with Docker Swarm on openSUSE
Clustering Docker with Docker Swarm on openSUSESaputro Aryulianto
 
Dockerizing Ruby Applications - The Best Practices
Dockerizing Ruby Applications - The Best PracticesDockerizing Ruby Applications - The Best Practices
Dockerizing Ruby Applications - The Best PracticesKontena, Inc.
 
Docker Networking - Current Status and goals of Experimental Networking
Docker Networking - Current Status and goals of Experimental NetworkingDocker Networking - Current Status and goals of Experimental Networking
Docker Networking - Current Status and goals of Experimental NetworkingSreenivas Makam
 
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
 
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
 

Similar to MySQL | My SQL docker containerization | Docker Network (20)

Docker Networking Overview
Docker Networking OverviewDocker Networking Overview
Docker Networking Overview
 
Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting Techniques
 
Docker meetup
Docker meetupDocker meetup
Docker meetup
 
Docker 101
Docker 101Docker 101
Docker 101
 
Docker on Power Systems
Docker on Power SystemsDocker on Power Systems
Docker on Power Systems
 
Conatiner Networking with MidoNet
Conatiner Networking with MidoNetConatiner Networking with MidoNet
Conatiner Networking with MidoNet
 
Managing multicast/igmp stream on Docker
Managing multicast/igmp stream on DockerManaging multicast/igmp stream on Docker
Managing multicast/igmp stream on Docker
 
Deploying Microservice on Docker
Deploying Microservice on DockerDeploying Microservice on Docker
Deploying Microservice on Docker
 
ContainerDays Boston 2016: "Docker For the Developer" (Borja Burgos)
ContainerDays Boston 2016: "Docker For the Developer" (Borja Burgos)ContainerDays Boston 2016: "Docker For the Developer" (Borja Burgos)
ContainerDays Boston 2016: "Docker For the Developer" (Borja Burgos)
 
Practical Design Patterns in Docker Networking
Practical Design Patterns in Docker NetworkingPractical Design Patterns in Docker Networking
Practical Design Patterns in Docker Networking
 
Running .NET on Docker
Running .NET on DockerRunning .NET on Docker
Running .NET on Docker
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
 
Oracle Database 18c Docker.pdf
Oracle Database 18c Docker.pdfOracle Database 18c Docker.pdf
Oracle Database 18c Docker.pdf
 
Network Design patters with Docker
Network Design patters with DockerNetwork Design patters with Docker
Network Design patters with Docker
 
DockerCC.pdf
DockerCC.pdfDockerCC.pdf
DockerCC.pdf
 
Clustering Docker with Docker Swarm on openSUSE
Clustering Docker with Docker Swarm on openSUSEClustering Docker with Docker Swarm on openSUSE
Clustering Docker with Docker Swarm on openSUSE
 
Dockerizing Ruby Applications - The Best Practices
Dockerizing Ruby Applications - The Best PracticesDockerizing Ruby Applications - The Best Practices
Dockerizing Ruby Applications - The Best Practices
 
Docker Networking - Current Status and goals of Experimental Networking
Docker Networking - Current Status and goals of Experimental NetworkingDocker Networking - Current Status and goals of Experimental Networking
Docker Networking - Current Status and goals of Experimental Networking
 
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
 
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
 

Recently uploaded

Digital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksDigital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksdeepakthakur548787
 
convolutional neural network and its applications.pdf
convolutional neural network and its applications.pdfconvolutional neural network and its applications.pdf
convolutional neural network and its applications.pdfSubhamKumar3239
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Seán Kennedy
 
SMOTE and K-Fold Cross Validation-Presentation.pptx
SMOTE and K-Fold Cross Validation-Presentation.pptxSMOTE and K-Fold Cross Validation-Presentation.pptx
SMOTE and K-Fold Cross Validation-Presentation.pptxHaritikaChhatwal1
 
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Boston Institute of Analytics
 
What To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptxWhat To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptxSimranPal17
 
wepik-insightful-infographics-a-data-visualization-overview-20240401133220kwr...
wepik-insightful-infographics-a-data-visualization-overview-20240401133220kwr...wepik-insightful-infographics-a-data-visualization-overview-20240401133220kwr...
wepik-insightful-infographics-a-data-visualization-overview-20240401133220kwr...KarteekMane1
 
Principles and Practices of Data Visualization
Principles and Practices of Data VisualizationPrinciples and Practices of Data Visualization
Principles and Practices of Data VisualizationKianJazayeri1
 
Networking Case Study prepared by teacher.pptx
Networking Case Study prepared by teacher.pptxNetworking Case Study prepared by teacher.pptx
Networking Case Study prepared by teacher.pptxHimangsuNath
 
Bank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis ProjectBank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis ProjectBoston Institute of Analytics
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryJeremy Anderson
 
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxmodul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxaleedritatuxx
 
English-8-Q4-W3-Synthesizing-Essential-Information-From-Various-Sources-1.pdf
English-8-Q4-W3-Synthesizing-Essential-Information-From-Various-Sources-1.pdfEnglish-8-Q4-W3-Synthesizing-Essential-Information-From-Various-Sources-1.pdf
English-8-Q4-W3-Synthesizing-Essential-Information-From-Various-Sources-1.pdfblazblazml
 
Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Seán Kennedy
 
The Power of Data-Driven Storytelling_ Unveiling the Layers of Insight.pptx
The Power of Data-Driven Storytelling_ Unveiling the Layers of Insight.pptxThe Power of Data-Driven Storytelling_ Unveiling the Layers of Insight.pptx
The Power of Data-Driven Storytelling_ Unveiling the Layers of Insight.pptxTasha Penwell
 
Cyber awareness ppt on the recorded data
Cyber awareness ppt on the recorded dataCyber awareness ppt on the recorded data
Cyber awareness ppt on the recorded dataTecnoIncentive
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPTBoston Institute of Analytics
 
Decoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis ProjectDecoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis ProjectBoston Institute of Analytics
 
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...Boston Institute of Analytics
 

Recently uploaded (20)

Digital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksDigital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing works
 
convolutional neural network and its applications.pdf
convolutional neural network and its applications.pdfconvolutional neural network and its applications.pdf
convolutional neural network and its applications.pdf
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...
 
SMOTE and K-Fold Cross Validation-Presentation.pptx
SMOTE and K-Fold Cross Validation-Presentation.pptxSMOTE and K-Fold Cross Validation-Presentation.pptx
SMOTE and K-Fold Cross Validation-Presentation.pptx
 
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
 
What To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptxWhat To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptx
 
wepik-insightful-infographics-a-data-visualization-overview-20240401133220kwr...
wepik-insightful-infographics-a-data-visualization-overview-20240401133220kwr...wepik-insightful-infographics-a-data-visualization-overview-20240401133220kwr...
wepik-insightful-infographics-a-data-visualization-overview-20240401133220kwr...
 
Principles and Practices of Data Visualization
Principles and Practices of Data VisualizationPrinciples and Practices of Data Visualization
Principles and Practices of Data Visualization
 
Networking Case Study prepared by teacher.pptx
Networking Case Study prepared by teacher.pptxNetworking Case Study prepared by teacher.pptx
Networking Case Study prepared by teacher.pptx
 
Bank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis ProjectBank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis Project
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data Story
 
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxmodul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
 
Data Analysis Project: Stroke Prediction
Data Analysis Project: Stroke PredictionData Analysis Project: Stroke Prediction
Data Analysis Project: Stroke Prediction
 
English-8-Q4-W3-Synthesizing-Essential-Information-From-Various-Sources-1.pdf
English-8-Q4-W3-Synthesizing-Essential-Information-From-Various-Sources-1.pdfEnglish-8-Q4-W3-Synthesizing-Essential-Information-From-Various-Sources-1.pdf
English-8-Q4-W3-Synthesizing-Essential-Information-From-Various-Sources-1.pdf
 
Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...
 
The Power of Data-Driven Storytelling_ Unveiling the Layers of Insight.pptx
The Power of Data-Driven Storytelling_ Unveiling the Layers of Insight.pptxThe Power of Data-Driven Storytelling_ Unveiling the Layers of Insight.pptx
The Power of Data-Driven Storytelling_ Unveiling the Layers of Insight.pptx
 
Cyber awareness ppt on the recorded data
Cyber awareness ppt on the recorded dataCyber awareness ppt on the recorded data
Cyber awareness ppt on the recorded data
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
 
Decoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis ProjectDecoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis Project
 
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
 

MySQL | My SQL docker containerization | Docker Network

  • 1. MySQL Docker Containerization ©2020 Shrenik Parekh. All rights reserved. 1
  • 2. 2 ©2020 Shrenik Parekh. All rights reserved. Docker Introduction ● Container can be installed on Bare-metal, Physical / Virtual Machine, Cloud instance ● Host could be Windows, Linux or Mac OS X ● Docker image run as a single process ● Docker images are available on Docker One image can fire many containers ● Package an application with all dependencies ● Lightweight virtual machine ● Doesn’t require operating system ● Linux kernel libraries shared with containers ● Each container runs specific task
  • 3. 3 ©2020 Shrenik Parekh. All rights reserved. Docker Network Docker Network drivers: Pluggable, ● Bridge – Default, used when application runs in standalone mode ● Host – For standalone container, no network isolation between container and docker host, use host network directly ● Overlay – Multi host networking ● Macvlam - ● Third party Network Plugins Ref.: https://docs.docker.com/network/ https://www.docker.com/blog/understanding-docker-networking-drivers-use-cases/
  • 4. 4 ©2020 Shrenik Parekh. All rights reserved. Bridge Network ● Default, simple to use, simple to troubleshoot, good choice for developer ● The bridge driver is a local scope driver, it only provides service discovery, IPAM (IP address management), and connectivity on a single host ● Creates private network internal to the host ● External access granted by exposing ports ● Secures the network by managing rules that block connectivity between different Docker networks ● Docker Engine creates the necessary Linux bridges, internal interfaces, iptables rules ● Host routes to make this connectivity possible
  • 5. 5 ©2020 Shrenik Parekh. All rights reserved. Bridge Network
  • 6. 6 ©2020 Shrenik Parekh. All rights reserved. Bridge Network Ref.: https://medium.com/@jamesemyn/basic-docker-networking-9130ab889359
  • 7. 7 ©2020 Shrenik Parekh. All rights reserved. Create Bridge Network Create Docker bridge mybridge: $docker network create -d bridge mybridge Run Docker container db: $docker run -d --net mybridge --name db redis Run docker container web: $docker run -d --net mybridge -e DB=db -p 8000:5000 -- name web chrch/web
  • 8. 8 ©2020 Shrenik Parekh. All rights reserved. Host Network ● For standalone container ● No network isolation between container and docker host ● Use host network directly ● Container does not get its own IP-address allocated ● port-mapping does not take effect if you specify ● The -p, --publish, -P, and --publish-all option are ignored, and produce warning ● Host mode networking can be useful to optimize performance, and in situations where a container needs to handle a large range of ports, as it does not require network address translation (NAT), and no “userland-proxy” is created for each port ● The host networking driver only works on Linux hosts ● Not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server
  • 9. 9 ©2020 Shrenik Parekh. All rights reserved. Host Network Ref.: https://medium.com/@jamesemyn/basic-docker-networking-9130ab889359
  • 10. 10 ©2020 Shrenik Parekh. All rights reserved. Overlay Network ● Built in, multi host networking, swarm scope driver ● Operates across an entire Swarm or UCP cluster ● IPAM, service discovery, multi-host connectivity, encryption, and load balancing are built right in ● Driver utilizes an industry-standard VXLAN data plane that decouples the container network from the underlying physical network (the underlay). ● Network policy, visibility, and security is controlled centrally through the Docker Universal Control Plane (UCP).
  • 11. 11 ©2020 Shrenik Parekh. All rights reserved. Overlay Network Ref.: https://www.docker.com/blog/understanding-docker-networking-drivers-use-cases/
  • 12. 12 ©2020 Shrenik Parekh. All rights reserved. MySQL Docker Container Common commands use for MySQL running in container Find Docker Version: # docker –v List Docker Container: # docker ps –a Fetch MySQL logs: # docker logs <container_name> 2>&1 | grep GENERATED Connect MySQL: #docker exec -it <container_name> mysql -uroot -p
  • 13. 13 ©2020 Shrenik Parekh. All rights reserved. MySQL Docker Container Connect MySQL file system in Docker: #docker exec -it <container_name> bash Backup MySQL databases using mysqldump: # docker exec [MYSQL_CONTAINER] /usr/bin/mysqldump -u [MYSQL_USER] --password=[MYSQL_PASSWORD] --all-databases > backup.sql Restore MySQL databases: # cat backup.sql | docker exec -i [MYSQL_CONTAINER] /usr/bin/mysql -u [MYSQL_USER] --password=[MYSQL_PASSWORD] [MYSQL_DATABASE]
  • 14. 14 ©2020 Shrenik Parekh. All rights reserved. Master Slave Replication - Same Host Ref.: http://khmel.org/docker-containers-with-mysql-master-slave-replication.html
  • 15. 15 ©2020 Shrenik Parekh. All rights reserved. Master Slave Replication - Different Host
  • 16. 16 ©2020 Shrenik Parekh. All rights reserved. Persistent MySQL Docker Container
  • 17. 17 ©2020 Shrenik Parekh. All rights reserved. Backup MySQL Database in Container https://storageswiss.com/2016/05/19/backing-up- databases-in-docker-containers/