20180726

Docker

Docker in 12 minutes: https://www.youtube.com/watch?v=YFl2mCHdv24

Docker compose in 12 minutes: https://www.youtube.com/watch?v=Qw9zlE3t8Ko

Docker on AWS: https://hackernoon.com/running-docker-on-aws-ec2-83a14b780c56

Laravel + Docker Part 1

Laravel + Docker Part 2 — preparing for production

Laradock docs: http://laradock.io/documentation/

Contents of a simple Dockerfile:
FROM php:7.0-apache
COPY src/ /var/www/html/
EXPOSE 80

Build a simple Dockerfile:
docker build -t hello-world .
Run a simple docker image:
docker run -p 8001:80 -v /home/user/projects/docker/src/:/var/www/html/ hello-world

Stop all docker containers:
docker stop $(docker ps -a -q)

Remove all docker containers:
docker rm $(docker ps -a -q)

Setting up a Laravel environment:

Make a new directory for your project and execute the following:
git clone https://github.com/laravel/laravel.git
cd laravel
rm -rf .git
git clone https://github.com/Laradock/laradock.git
#OR #git init
#git submodule add https://github.com/LaraDock/laradock.git
cp .env.example .env
### now change the Laravel .env file with the change described later
cd laradock/
cp env-example .env
### now change the MYSQL_VERSION in .env file to 5.7 to avoid authentication errors
docker-compose up -d nginx mysql phpmyadmin redis workspace
docker exec -it laradock_workspace_1 bash
root@dockerContainer:/var/www# composer install
root@dockerContainer:/var/www# php artisan migrate:install
root@dockerContainer:/var/www# php artisan migrate:status
...
docker-compose down
 Changes in Laravel project .env file:
DB_HOST=mysql
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
REDIS_HOST=redis
QUEUE_HOST=beanstalkd

Changes in Laradock .env file (if previously built, check https://github.com/laradock/laradock/issues/1407 ):
MYSQL_VERSION=5.7
Changes in .gitignore in Laravel project (add):
/laradock


p.s. Laravel on AWS with beanstalk: https://www.youtube.com/watch?v=ISVaMijczKc
root@7193d0b0ef22:~# npm install apidoc -g