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

VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...Suhani Kapoor
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 

Recently uploaded (20)

VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
Decoding Loan Approval: Predictive Modeling in Action
Decoding Loan Approval: Predictive Modeling in ActionDecoding Loan Approval: Predictive Modeling in Action
Decoding Loan Approval: Predictive Modeling in Action
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 

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/