From Dummies to RockStars

@locnh

$ cat READme.md

Based on a true story ...

This slide is for developers who have no live with a nagging pain called "environment preparation" ...

about a nightmare in software industry ...

Nah, actually it's not a horror movie

because, at least, we have docker

"Move your ass or keep enjoying the old shit !!"

$ cat READme.md

  • The examples in this slide are about Magento
  • The goal is everyone can have development environment in less than 10 mins

PREface

$ whoami

  • https://locnh.com
  • https://linkedin.com/in/locnh
  • https://github.com/locnh
  • https://hub.docker.com/u/locnh

Why docker ?

Why docker ?

WHY SHOULD YOU CARE?

  • It's fast
  • Minimal overhead/resource usage
  • Run thousands of containers
  • Easy to run your whole production stack locally

Sexy enough ?

LIFE without docker

  • Multiple versions of Software
  • Multiple version of Technology
  • Need to be ready ASAP

Requirements

Let's rock With docker

Let's rock With docker

PHP 5 / NginX

PHP 5 / Apache

PHP 7 / NginX

PHP 7 / Apache

Magento 1.x

Magento 2.X

Ez enough ?

what do we have so far with docker ?

Everyone in a team with the same Project

Will have the same working environment

  • The same version of software
  • The same configurations
  • Easy to integrate with other containters

What is docker ?

Docker is ..

  • "Open platform for developers and sysadmins to build, ship, and run distributed applications. "
  • Light weight containers
  • Available on most linux distros

What's a container ?

What's a container ?

Docker container

Docker vs Virtual Machine

Docker container vs Virtual Machine

Let's the fun BEGIN

(For the dummies)

Get the docker at https://www.docker.com/

INSTALL DOCKER

 $ docker pull NAME

PUll the images

 $ docker run NAME

LAUNCH A CONTAINER

  • Windows / Mac OS: Download install package and run, it's easy.
  • Linux: Run this command as root, it's extremely easy.
 # curl -sSL https://get.docker.com/ | sh

Let's the fun BEGIN

(For the dummies)
 $ docker ps

container status

 $ docker stop NAME

STOP a container

 $ docker start NAME

START a container

DOCKER IN ACTION

(For the dummies)
 $ docker pull percona:5.7
 $ docker run --name percona57 -p 3306:3306 \
              -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
              -d percona:5.7

BUILD A PERCONA CONTAINER

 $ docker ps
 $ docker stop percona57
 $ docker start percona57

DOCKER IN ACTION

(For the dummies)
 $ docker pull locnh/docker-magento:2-dev
 $ docker run --name magento21 -p 80:80 \
              -v /path/to/magento:/var/www/html \
              -d locnh/docker-magento:2-dev

BUILD A NGINX-PHP CONTAINER FOR MAGENTO 2

 -v host_dir:container_dir
 -p host_port:container_port

More options

DOCKER IN ACTION

(For the dummies)
 $ docker exec -it magento21 bash
​ [root@magento21 /]#

GET INSIDE THE CONTAINER (for debug)

 [root@magento21 /]# id
 uid=0(root) gid=0(root) groups=0(root)
 [root@magento21 /]# exit
 $ 

DOCKER IN ACTION

(For the dummies)

how to check your APP

 $ curl http://localhost
 $ mysql -h localhost -p 3306 -u root

Ez enough ?

on the way to become a RockStar

 $ docker commit magento21 username/reponame

COMMIT your container with your work

 $ docker login

Register a docker hub account

PUSH your image and share your repo

 $ docker push username/reponame
 $ docker images

on the way to become a RockStar

OR just share dockerfile

THANKS FOR your attendance !

Credits

Content    Internet

Media    Internet

Deck    slides.com

Images storage    hub.docker.com

Code storage   github.com

Actor   Docker Whale

Director   /me