KEMBAR78
Docker with WordPress | PPTX
WordPress with Docker
Workshop
Devarshi Sathiya Imran Sayed
What do I need to know to learn Docker?
● At Least know to use the command line usage and tools
What is Docker?
● Docker is an open-source software
platform for building container based
applications ( started in 2013 )
● It carves up a computer into sealed
containers that run your code.
● Containers are small and lightweight
execution environments that make
shared use of the operating system
kernel but otherwise run in isolation
from one another
Docker in a nutshell
Computer
You Interact with a client-program
name docker cli
Docker needs a Linux server to manage - so we run linux serve in a virtual machine
Server-program - docker host
Interact with a
server-program
name docker host Linux Virtual Machine
Docker Desktop
For Mac For Windows
Docker build
Docker pull
More about Docker
● Docker is a client-program that you
run from the terminal
● Docker is also a server program that
manages the linux system
● Its a program that takes your code
bundles it up and seals into a
container.
● Docker is also a service that
distributes containers so people can
share their work.
Why Docker?
● Developing apps today can require multiple languages,
frameworks, architectures.
● Docker simplifies and accelerates your workflow.
● It gives developers the freedom to innovate with their choice
of tools, application stacks, and deployment environments for
each project
Why Docker?
● Simplicity - Docker’s friendly, CLI-based workflow makes
building, sharing, and running containerized applications
accessible to developers of all skill levels.
● Agile - Install from a single package to get up and
running in minutes. Code and test locally while ensuring
consistency between development and production.
● Collaborate -Use Certified and community-provided
images in your project. Push to a cloud-based
application registry and collaborate with team members.
Docker today
Docker Containers Are Everywhere:
Linux, Windows, Data center, Cloud, Serverless, etc.
Docker Vs Virtual Machines
Docker Flow
Image
A file that makes up just enough
OS that you need
Running
Container
A container is an image that has
process running in it
Docker run
Stopped
Container
A container that has the process
stopped running.
New Image
Docker commit
New image created
from the exited container
Creates a new container
Docker
kill
What is Docker Container?
● A self-contained sealed unit of
software
● Contains everything needed to run the
service.
● It bundles together all the code,
config, processes, networking,
dependencies and just enough
operating system to run your code.
Docker installation
Install Docker
● Docker Desktop - on Mac and Windows
● Docker on Ubuntu
Creating a container
What is docker
compose?
docker run -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=wordpress --name
wordpressdb -v "$PWD/database":/var/lib/mysql -d mariadb:latest
Setting up WordPress
with Docker
version: '3.3'
services:
composer:
image: composer
command: update
volumes:
- ./wordpress:/app
mysql:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
volumes:
- ./mysql:/var/lib/mysql
phpmyadmin:
image: phpmyadmin/phpmyadmin
depends_on:
- mysql
environment:
PMA_HOST: mysql
PMA_PORT: 3306
PMA_ARBITRARY: 1
restart: always
ports:
- 8183:80
wordpress:
depends_on:
- mysql
- composer
image: wordpress:latest
ports:
- "8020:80"
restart: always
environment:
WORDPRESS_DB_HOST: mysql:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
Demo
● Deploy on local
● Show WordPress on :8020
● Show phpMyAdmin
References
● https://techio.dev/docker/docker-for-kids.html
● https://techio.dev/docker/docker-networks-and-volumes.html
● https://www.docker.com/blog/containers-replacing-virtual-
machines/

Docker with WordPress

  • 1.
  • 2.
    What do Ineed to know to learn Docker? ● At Least know to use the command line usage and tools
  • 3.
    What is Docker? ●Docker is an open-source software platform for building container based applications ( started in 2013 ) ● It carves up a computer into sealed containers that run your code. ● Containers are small and lightweight execution environments that make shared use of the operating system kernel but otherwise run in isolation from one another
  • 4.
    Docker in anutshell Computer You Interact with a client-program name docker cli Docker needs a Linux server to manage - so we run linux serve in a virtual machine Server-program - docker host Interact with a server-program name docker host Linux Virtual Machine Docker Desktop For Mac For Windows Docker build Docker pull
  • 5.
    More about Docker ●Docker is a client-program that you run from the terminal ● Docker is also a server program that manages the linux system ● Its a program that takes your code bundles it up and seals into a container. ● Docker is also a service that distributes containers so people can share their work.
  • 6.
    Why Docker? ● Developingapps today can require multiple languages, frameworks, architectures. ● Docker simplifies and accelerates your workflow. ● It gives developers the freedom to innovate with their choice of tools, application stacks, and deployment environments for each project
  • 7.
    Why Docker? ● Simplicity- Docker’s friendly, CLI-based workflow makes building, sharing, and running containerized applications accessible to developers of all skill levels. ● Agile - Install from a single package to get up and running in minutes. Code and test locally while ensuring consistency between development and production. ● Collaborate -Use Certified and community-provided images in your project. Push to a cloud-based application registry and collaborate with team members.
  • 8.
    Docker today Docker ContainersAre Everywhere: Linux, Windows, Data center, Cloud, Serverless, etc.
  • 9.
  • 10.
    Docker Flow Image A filethat makes up just enough OS that you need Running Container A container is an image that has process running in it Docker run Stopped Container A container that has the process stopped running. New Image Docker commit New image created from the exited container Creates a new container Docker kill
  • 11.
    What is DockerContainer? ● A self-contained sealed unit of software ● Contains everything needed to run the service. ● It bundles together all the code, config, processes, networking, dependencies and just enough operating system to run your code.
  • 12.
  • 13.
    Install Docker ● DockerDesktop - on Mac and Windows ● Docker on Ubuntu
  • 14.
  • 15.
  • 16.
    docker run -eMYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=wordpress --name wordpressdb -v "$PWD/database":/var/lib/mysql -d mariadb:latest
  • 17.
  • 18.
  • 19.
    mysql: image: mysql:5.7 restart: always environment: MYSQL_ROOT_PASSWORD:root MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress volumes: - ./mysql:/var/lib/mysql
  • 20.
    phpmyadmin: image: phpmyadmin/phpmyadmin depends_on: - mysql environment: PMA_HOST:mysql PMA_PORT: 3306 PMA_ARBITRARY: 1 restart: always ports: - 8183:80
  • 21.
    wordpress: depends_on: - mysql - composer image:wordpress:latest ports: - "8020:80" restart: always environment: WORDPRESS_DB_HOST: mysql:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress
  • 22.
    Demo ● Deploy onlocal ● Show WordPress on :8020 ● Show phpMyAdmin
  • 23.

Editor's Notes

  • #10 Containers and virtual machines have similar resource isolation and allocation benefits, but function differently because containers virtualize the operating system instead of hardware. Containers are more portable and efficient. VM runs their own OS while container share the Kernel of the host system. As a VM is running a full OS, it will need more resources in terms of hardware and the boot time will be slower than a docker container. As you can see in the picture, the Docker is running directly on the host operating system and the container of our APP is directly running on Docker container. But in case of VM, there's a full Operating System running on the top of the hypervisor. And as mentioned before a Operating System is more resource hungry.