SlideShare uma empresa Scribd logo
1 de 19
Baixar para ler offline
Docker
Abid H. Malik
The problems
● IROMS (It Runs On My System) Syndrome.
● Unwanted updates to a system library / package / service.
● Underlying OS / OS Components changed.
● Upgrade in one service for Project A affected Project B.
● Team does not have standardized setup.
● Setup on new systems takes a lot of time.
Containerization
● Containerization involves encapsulating or packaging up software code and all its
dependencies so that it can run uniformly and consistently on any infrastructure.
● Develop and run the application inside an isolated environment (known as a container)
that matches your final deployment environment.
● Put your application inside a single file (known as an image) along with all its
dependencies and necessary deployment configurations.
● And share that image through a central server (known as a registry) that is accessible by
anyone with proper authorization
● Docker is One of many implementations of the ides of Containerization.
● It's an open-source containerization platform that allows you to containerize your
applications, share them using public or private registries, and also to orchestrate them.
What is Docker?
01 Docker is an open platform for developing, shipping, and running applications.
Docker enables you to separate your applications from your infrastructure so
you can deliver software quickly.
02 Docker provides the ability to package and run an application in a loosely
isolated environment called a container. The isolation and security allow you to
run many containers simultaneously on a given host.
03 Docker is a tool designed to make it easier to create, deploy, and run
applications by using containers. Docker containers are lightweight alternatives
to Virtual Machines and it uses the host OS.
Docker Benefits
● Runs on my machine = runs anywhere.
● New team member can be productive from day 1.
● Test app's compatibility with the newer version of
language/database.
● Boosts your career. (Preference for Docker Skill up by 50%).
● And lot more….
Docker architecture
● The Docker daemon (dockerd)
● The Docker client (docker)
● Docker Desktop
● Docker registries
● Docker objects
○ Containers
○ Images
○ Networks
○ Volumes
○ plugins
Docker + Magento
Prerequisites
● Docker hub account
● Docker Desktop (Mac OS and Windows)
● Docker WSL Linux Image setup (Windows only)
● Docker Engine (for Linux)
○ https://docs.docker.com/engine/install/ubuntu/
● Post-installation steps for Linux
○ https://docs.docker.com/engine/install/linux-postinstall/
● Docker Compose
○ https://docs.docker.com/compose/install/
● Git
● Composer
● Magento Marketplace Keys
● Curl
Setup New Project - Automated
1. Create your project directory then go into it:
a. mkdir ~/Sites/magento
b. cd $_
2. Run this automated one-liner from the directory you want to install your project.
a. curl -s
https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup |
bash -s -- magento.test 2.4.3-p1
3. After the one-liner above completes running, you should be able to access your site
at https://magento.test
Setup New Project - Manual
1) Create your project directory then go into it:
a) mkdir ~/Sites/magento
b) cd $_
2) Download the Docker Compose template:
a) curl -s
https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template |
bash
3) Download the version of Magento you want to use with:
a) bin/download 2.4.3-p1
4) Run the setup installer for Magento:
a) bin/setup magento.test
5) open https://magento.test
Setup Existing Projects
1. Take a backup of your existing database:
a. bin/mysqldump > ~/Sites/existing/magento.sql
2. Create your project directory then go into it:
a. mkdir ~/Sites/magento
b. cd $_
3. Download the Docker Compose template:
a. curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash
4. Replace with existing source code of your existing Magento instance:
a. cp -R ~/Sites/existing src OR
b. git clone git@github.com:myrepo.git src
5. Start some containers, copy files to them and then restart the containers:
a. docker-compose -f docker-compose.yml up -d
b. bin/copytocontainer --all
Setup Existing Projects - Contd…
6. Import existing database:
a. bin/mysql < ../existing/magento.sql
7. Update database connection details to use the above Docker MySQL credentials:
a. creds for the MySQL server are defined at startup from env/db.env
8. Import app-specific environment settings:
a. bin/magento app:config:import
9. Create a DNS host entry and setup Magento base url
a. bin/setup-domain yoursite.test
10. bin/restart
11. open https://yoursite.test
Important Files
● docker-compose.yml
● docker-compose.dev.yml
● bin/*
● env/*
Important CLI commands
● bin/bash
○ Drop into the bash prompt of your Docker container.
● bin/cli
○ Run any CLI command without going into the bash prompt. Ex. bin/cli ls
● bin/composer
○ Run the composer binary. Ex. bin/composer install
● bin/copyfromcontainer
○ Copy folders or files from container to host. Ex. bin/copyfromcontainer vendor
● bin/copytocontainer
○ Copy folders or files from host to container. Ex. bin/copytocontainer --all
● bin/cron:
○ Start or stop the cron service. Ex. bin/cron start
Important CLI commands - Contd…
● bin/fixowns
○ This will fix filesystem ownerships within the container.
● bin/fixperms
○ This will fix filesystem permissions within the container.
● bin/magento
○ Run the Magento CLI. Ex: bin/magento cache:flush
● bin/mysql
○ Run the MySQL CLI with database config from env/db.env
● bin/mysqldump
○ Backup the Magento database. Ex. bin/mysqldump > magento.sql
● bin/status:
○ Check the container status.
Important CLI commands - Contd…
● bin/stop
○ Stop all project containers.
● bin/start
○ Start all containers, good practice to use this instead of docker-compose up -d, as it may contain
additional helpers.
● bin/restart
○ Stop and then start all containers.
● bin/setup-domain
○ Setup Magento domain name. Ex: bin/setup-domain magento.test
● bin/update
○ Update your project to the most recent version of docker-magento
Miscellaneous Commands
● Get IP address of remote host (host.docker.internal)
○ docker run --rm alpine ip route | awk 'NR==1 {print $3}'
● Get IP address of container
○ docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_id>
Helpful Links
● https://hub.docker.com/login
● https://www.docker.com/products/docker-desktop
● https://docs.docker.com/engine/install/ubuntu/
● https://docs.docker.com/engine/install/linux-postinstall/
● https://docs.docker.com/compose/install/
● https://github.com/markshust/docker-magento#docker-hub
● https://account.magento.com/customer/account/login
Thank you!

Mais conteúdo relacionado

Mais procurados

Presentation On Group Policy in Windows Server 2012 R2 By Barek-IT
Presentation On Group Policy in Windows Server 2012 R2 By Barek-ITPresentation On Group Policy in Windows Server 2012 R2 By Barek-IT
Presentation On Group Policy in Windows Server 2012 R2 By Barek-IT
Md. Abdul Barek
 

Mais procurados (20)

Introduction to Xdebug
Introduction to XdebugIntroduction to Xdebug
Introduction to Xdebug
 
Portfolio Software Engineer
Portfolio Software EngineerPortfolio Software Engineer
Portfolio Software Engineer
 
Hidden Secrets of Magento Price Rules
Hidden Secrets of Magento Price RulesHidden Secrets of Magento Price Rules
Hidden Secrets of Magento Price Rules
 
Owl: The New Odoo UI Framework
Owl: The New Odoo UI FrameworkOwl: The New Odoo UI Framework
Owl: The New Odoo UI Framework
 
Ionic, AngularJS,Cordova,NodeJS,Sass
Ionic, AngularJS,Cordova,NodeJS,SassIonic, AngularJS,Cordova,NodeJS,Sass
Ionic, AngularJS,Cordova,NodeJS,Sass
 
WordPress Seminar
WordPress SeminarWordPress Seminar
WordPress Seminar
 
Windows Deployment Services Tutorial
Windows Deployment Services TutorialWindows Deployment Services Tutorial
Windows Deployment Services Tutorial
 
Presentation On Group Policy in Windows Server 2012 R2 By Barek-IT
Presentation On Group Policy in Windows Server 2012 R2 By Barek-ITPresentation On Group Policy in Windows Server 2012 R2 By Barek-IT
Presentation On Group Policy in Windows Server 2012 R2 By Barek-IT
 
Advanced front-end automation with npm scripts
Advanced front-end automation with npm scriptsAdvanced front-end automation with npm scripts
Advanced front-end automation with npm scripts
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
Angular components
Angular componentsAngular components
Angular components
 
CPanel User Guide
CPanel User GuideCPanel User Guide
CPanel User Guide
 
How to develop automated tests
How to develop automated testsHow to develop automated tests
How to develop automated tests
 
WordPress Security for Beginners
WordPress Security for BeginnersWordPress Security for Beginners
WordPress Security for Beginners
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
Vi editor
Vi editorVi editor
Vi editor
 
Android Hacking
Android HackingAndroid Hacking
Android Hacking
 
React hooks
React hooksReact hooks
React hooks
 
React workshop
React workshopReact workshop
React workshop
 

Semelhante a Magento Docker Setup.pdf

Semelhante a Magento Docker Setup.pdf (20)

Introduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataIntroduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxData
 
Docker up and Running For Web Developers
Docker up and Running For Web DevelopersDocker up and Running For Web Developers
Docker up and Running For Web Developers
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web Developers
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
 
DOCKER-PIAIC-SLIDES
DOCKER-PIAIC-SLIDESDOCKER-PIAIC-SLIDES
DOCKER-PIAIC-SLIDES
 
Docker 101
Docker 101Docker 101
Docker 101
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
 
Testing fácil con Docker: Gestiona dependencias y unifica entornos
Testing fácil con Docker: Gestiona dependencias y unifica entornosTesting fácil con Docker: Gestiona dependencias y unifica entornos
Testing fácil con Docker: Gestiona dependencias y unifica entornos
 
Best Practices for Developing & Deploying Java Applications with Docker
Best Practices for Developing & Deploying Java Applications with DockerBest Practices for Developing & Deploying Java Applications with Docker
Best Practices for Developing & Deploying Java Applications with Docker
 
Containerization using docker and its applications
Containerization using docker and its applicationsContainerization using docker and its applications
Containerization using docker and its applications
 
Containerization using docker and its applications
Containerization using docker and its applicationsContainerization using docker and its applications
Containerization using docker and its applications
 
[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 
Docker on Power Systems
Docker on Power SystemsDocker on Power Systems
Docker on Power Systems
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
Introduction to Docker for NodeJs developers at Node DC 2/26/2014
Introduction to Docker for NodeJs developers at Node DC 2/26/2014Introduction to Docker for NodeJs developers at Node DC 2/26/2014
Introduction to Docker for NodeJs developers at Node DC 2/26/2014
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

Magento Docker Setup.pdf

  • 2. The problems ● IROMS (It Runs On My System) Syndrome. ● Unwanted updates to a system library / package / service. ● Underlying OS / OS Components changed. ● Upgrade in one service for Project A affected Project B. ● Team does not have standardized setup. ● Setup on new systems takes a lot of time.
  • 3. Containerization ● Containerization involves encapsulating or packaging up software code and all its dependencies so that it can run uniformly and consistently on any infrastructure. ● Develop and run the application inside an isolated environment (known as a container) that matches your final deployment environment. ● Put your application inside a single file (known as an image) along with all its dependencies and necessary deployment configurations. ● And share that image through a central server (known as a registry) that is accessible by anyone with proper authorization ● Docker is One of many implementations of the ides of Containerization. ● It's an open-source containerization platform that allows you to containerize your applications, share them using public or private registries, and also to orchestrate them.
  • 4. What is Docker? 01 Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. 02 Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host. 03 Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Docker containers are lightweight alternatives to Virtual Machines and it uses the host OS.
  • 5. Docker Benefits ● Runs on my machine = runs anywhere. ● New team member can be productive from day 1. ● Test app's compatibility with the newer version of language/database. ● Boosts your career. (Preference for Docker Skill up by 50%). ● And lot more….
  • 6. Docker architecture ● The Docker daemon (dockerd) ● The Docker client (docker) ● Docker Desktop ● Docker registries ● Docker objects ○ Containers ○ Images ○ Networks ○ Volumes ○ plugins
  • 8. Prerequisites ● Docker hub account ● Docker Desktop (Mac OS and Windows) ● Docker WSL Linux Image setup (Windows only) ● Docker Engine (for Linux) ○ https://docs.docker.com/engine/install/ubuntu/ ● Post-installation steps for Linux ○ https://docs.docker.com/engine/install/linux-postinstall/ ● Docker Compose ○ https://docs.docker.com/compose/install/ ● Git ● Composer ● Magento Marketplace Keys ● Curl
  • 9. Setup New Project - Automated 1. Create your project directory then go into it: a. mkdir ~/Sites/magento b. cd $_ 2. Run this automated one-liner from the directory you want to install your project. a. curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.3-p1 3. After the one-liner above completes running, you should be able to access your site at https://magento.test
  • 10. Setup New Project - Manual 1) Create your project directory then go into it: a) mkdir ~/Sites/magento b) cd $_ 2) Download the Docker Compose template: a) curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash 3) Download the version of Magento you want to use with: a) bin/download 2.4.3-p1 4) Run the setup installer for Magento: a) bin/setup magento.test 5) open https://magento.test
  • 11. Setup Existing Projects 1. Take a backup of your existing database: a. bin/mysqldump > ~/Sites/existing/magento.sql 2. Create your project directory then go into it: a. mkdir ~/Sites/magento b. cd $_ 3. Download the Docker Compose template: a. curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash 4. Replace with existing source code of your existing Magento instance: a. cp -R ~/Sites/existing src OR b. git clone git@github.com:myrepo.git src 5. Start some containers, copy files to them and then restart the containers: a. docker-compose -f docker-compose.yml up -d b. bin/copytocontainer --all
  • 12. Setup Existing Projects - Contd… 6. Import existing database: a. bin/mysql < ../existing/magento.sql 7. Update database connection details to use the above Docker MySQL credentials: a. creds for the MySQL server are defined at startup from env/db.env 8. Import app-specific environment settings: a. bin/magento app:config:import 9. Create a DNS host entry and setup Magento base url a. bin/setup-domain yoursite.test 10. bin/restart 11. open https://yoursite.test
  • 13. Important Files ● docker-compose.yml ● docker-compose.dev.yml ● bin/* ● env/*
  • 14. Important CLI commands ● bin/bash ○ Drop into the bash prompt of your Docker container. ● bin/cli ○ Run any CLI command without going into the bash prompt. Ex. bin/cli ls ● bin/composer ○ Run the composer binary. Ex. bin/composer install ● bin/copyfromcontainer ○ Copy folders or files from container to host. Ex. bin/copyfromcontainer vendor ● bin/copytocontainer ○ Copy folders or files from host to container. Ex. bin/copytocontainer --all ● bin/cron: ○ Start or stop the cron service. Ex. bin/cron start
  • 15. Important CLI commands - Contd… ● bin/fixowns ○ This will fix filesystem ownerships within the container. ● bin/fixperms ○ This will fix filesystem permissions within the container. ● bin/magento ○ Run the Magento CLI. Ex: bin/magento cache:flush ● bin/mysql ○ Run the MySQL CLI with database config from env/db.env ● bin/mysqldump ○ Backup the Magento database. Ex. bin/mysqldump > magento.sql ● bin/status: ○ Check the container status.
  • 16. Important CLI commands - Contd… ● bin/stop ○ Stop all project containers. ● bin/start ○ Start all containers, good practice to use this instead of docker-compose up -d, as it may contain additional helpers. ● bin/restart ○ Stop and then start all containers. ● bin/setup-domain ○ Setup Magento domain name. Ex: bin/setup-domain magento.test ● bin/update ○ Update your project to the most recent version of docker-magento
  • 17. Miscellaneous Commands ● Get IP address of remote host (host.docker.internal) ○ docker run --rm alpine ip route | awk 'NR==1 {print $3}' ● Get IP address of container ○ docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_id>
  • 18. Helpful Links ● https://hub.docker.com/login ● https://www.docker.com/products/docker-desktop ● https://docs.docker.com/engine/install/ubuntu/ ● https://docs.docker.com/engine/install/linux-postinstall/ ● https://docs.docker.com/compose/install/ ● https://github.com/markshust/docker-magento#docker-hub ● https://account.magento.com/customer/account/login