Using Docker for your development environment
Why Docker? Because it starting faster than vagrant, because you don't need to install all required libs, utils etc. on you OS, because you can make the same environment that on your production server and all developers that works on the project will use the same environment(same OS, same versions etc.).
I'll show in this post how to create LAMP containers group.
First that you need it's install Docker, just follow the instructions on official Docker site.
When you have Docker installed let's create directory structure for our containers:
Now let's create docker-compose settings file for our lamp containers group:
mysql it is our mysql server container, here we set environment variable MYSQL_ROOT_PASSWORD = root (you can check mysql on the Docker Hub and view all available environment variables) and volumes to store our mysql data on the local drive and make sure that our database data will not be removed after container restarting.
your_project - it is php-apache image. Here we set apache port as 80:80 - <your_pc_port>:<container_port>. And bind our project directory.
Now let's create directory for mysql data:
And define configs for our php-apache image:
Dockerfile contain php-apache image settings:
Now let's create a 000-default.conf file that will contain our VirtualHost settings:
Now edit your local hosts file and add your_project.local domain:
Add the following line to the hosts:
It's time to build and run!
So now, if everything fine, you can open in your browser http://your_project.local :)
P.S. if you need to connect to your container just run:
If something wrong you can check docker-compose logs:
You can add -f option and view logs in real time:
I'll show in this post how to create LAMP containers group.
First that you need it's install Docker, just follow the instructions on official Docker site.
When you have Docker installed let's create directory structure for our containers:
$ mkdir ~/docker-composedocker-compose directory will contain our docker-compose settings.
Now let's create docker-compose settings file for our lamp containers group:
$ cd ~/docker-compose $ mkdir lamp $ touch lamp/docker-compose.yml $ vim lamp/docker-compose.ymlAnd paste this code to the docker-compose.yml:
version: '3.2' services: mysql: image: mysql environment: MYSQL_ROOT_PASSWORD: root volumes: - ./mysql-data:/var/lib/mysql your_project: build: ./php ports: - "80:80" volumes: - type: "bind" source: /path/to/your/project target: /var/www/your_project links: - mysqlHere we can see two images mysql and your_project.
mysql it is our mysql server container, here we set environment variable MYSQL_ROOT_PASSWORD = root (you can check mysql on the Docker Hub and view all available environment variables) and volumes to store our mysql data on the local drive and make sure that our database data will not be removed after container restarting.
your_project - it is php-apache image. Here we set apache port as 80:80 - <your_pc_port>:<container_port>. And bind our project directory.
Now let's create directory for mysql data:
$ mkdir lamp/mysql-data
And define configs for our php-apache image:
$ mkdir lamp/php $ touch lamp/php/Dockerfile
Dockerfile contain php-apache image settings:
FROM php:7.0-apache #Uncomment if you need override some php settings #COPY php.ini /usr/local/etc/php/ #Uncomment if you need override apache config #COPY custom.conf /etc/apache2/conf-enabled/ #override host settings COPY 000-default.conf /etc/apache2/sites-enabled/ #install additional libs and php extentions RUN apt-get update \ && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev libmcrypt-dev nano mc \ && docker-php-ext-install mysqli pdo_mysql mbstring gd iconv mcrypt opcache #add your project domain name to the hosts file RUN echo 127.0.0.1 your_project.local > /etc/hosts #Uncomment if you need enable apache mod_rewrite #RUN a2enmod rewriteUnder directory lamp/php you can create additional files php.ini and custom.conf and uncomment COPY command in Dockerfile, this will allow you to specify your own php, apache settings.
Now let's create a 000-default.conf file that will contain our VirtualHost settings:
$ touch lamp/php/000-default.confAnd put this content to the 000-default.conf:
<virtualhost> ServerName your_project.local ServerAlias www.your_project.local DirectoryIndex index.php DocumentRoot "/var/www/your_project" <directory var/www/your_project> Order allow,deny Allow from all </directory> </virtualhost>
Now edit your local hosts file and add your_project.local domain:
$ vim /etc/hosts
Add the following line to the hosts:
127.0.0.1 your_project.local
It's time to build and run!
$ cd ~/docker-compose/lamp $ docker-compose build $ docker-compose up -d
So now, if everything fine, you can open in your browser http://your_project.local :)
P.S. if you need to connect to your container just run:
$ docker exec -i -t "container_name_1" /bin/bash
If something wrong you can check docker-compose logs:
$ docker-compose logs
You can add -f option and view logs in real time:
$ docker-compose logs -f
What is an each way meaning in horse racing each way meaning fun88 soikeotot fun88 soikeotot 카지노 가입 쿠폰 카지노 가입 쿠폰 jeetwin jeetwin 633Best Online Casinos for Real Money | TOP 10 트스 배팅 트스배팅 트스배팅 트스배팅 트스배팅 트스배팅 트스배팅 트스배팅 트스배팅 트스배팅 트스배팅 트스배팅 트스�
ReplyDeleteNo Deposit Cash Frenzy Casino Real Money Paypal 1xbet 1xbet fafafa gold casino
ReplyDeleteFun88 | VieCasino
ReplyDeleteFun88 is an online casino based in Curacao that was established in 2004 and has a wide 퍼스트 카지노 range of games. The casino offers a large amount of games for your 카지노사이트 enjoyment fun88 soikeotot
How to make money from betting on football - Work Tomake Money
ReplyDeleteIf you're having problems finding a winning bet online for jancasino.com the poormansguidetocasinogambling day of your choosing, ford escape titanium then there are 나비효과 plenty งานออนไลน์ of opportunities available right here.
Also, you need to certain you|ensure you|be positive to} play at a casino that has a huge choice of jackpot slots. 온라인 카지노 How can I improve my probabilities of winning on slot machinesPick high volatility slot machines with a Return to Player of 96% or more that enable bets of 0.20 or much less. This means you'll get more spins for the same amount of cash and you should have} larger probabilities to make use of the combination of volatility and RTP to win more.
ReplyDelete