Skip to content

Commit 75b1705

Browse files
committed
Merge remote-tracking branch 'LaraDock/master'
2 parents aa338d5 + 12587bc commit 75b1705

6 files changed

Lines changed: 164 additions & 37 deletions

File tree

README.md

Lines changed: 87 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# LaraDock
22

3-
[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](http://www.zalt.me)
3+
[![forthebadge](http://forthebadge.com/images/badges/built-by-developers.svg)](http://zalt.me)
44

55

66
LaraDock helps you run your **Laravel** App on **Docker** real quick.
@@ -15,6 +15,11 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
1515

1616

1717
- [Intro](#Intro)
18+
- [Features](#features)
19+
- [What is Docker](#what-is-docker)
20+
- [What is Laravel](#what-is-laravel)
21+
- [Why Docker not Vagrant](#why-docker-not-vagrant)
22+
- [LaraDock VS Homestead](#laradock-vs-homestead)
1823
- [Supported Containers](#Supported-Containers)
1924
- [Requirements](#Requirements)
2025
- [Installation](#Installation)
@@ -47,37 +52,86 @@ LaraDock strives to make the development experience easier.
4752
It contains pre-packaged Docker Images that provides you a wonderful development environment without requiring you to install PHP, NGINX, MySQL, REDIS, and any other software on your local machine.
4853

4954

55+
<a name="features"></a>
56+
### Features
5057

58+
- Easy switch between PHP versions: 7.0 - 5.6 - 5.5 - ...
59+
- Choose your favorite database engine: MySQL - Postgres - Redis - ...
60+
- Run your own combination of software's: PHP - NGINX - MySQL - ...
61+
- Every software runs on a separate container: PHP - NGINX - ...
62+
- Easy to customize any container, with simple edit to the `dockerfile`.
63+
- All Images extends from an official base Image. (Trusted base Images).
64+
- Pre-configured Nginx for Laravel. And very easy to update.
65+
- Using of a Data container, to keep the Data safe and accessible at anytime.
66+
- Easy to apply configurations inside containers.
67+
- Clean and well structured Dockerfiles (`dockerfile`).
68+
- Latest version of the Docker Compose file (`docker-compose`).
69+
- Everything is visible and editable.
70+
- Best practices everywhere.
71+
72+
73+
<a name="what-is-docker"></a>
5174
### What is Docker?
5275

5376
[Docker](https://www.docker.com) is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of [operating-system-level virtualization](https://en.wikipedia.org/wiki/Operating-system-level_virtualization) on Linux, Mac OS and Windows.
5477

78+
<a name="what-is-laravel"></a>
5579
### What is Laravel?
5680

5781
Seriously!!!
5882

83+
84+
<a name="why-docker-not-vagrant"></a>
5985
### Why Docker not Vagrant!?
60-
[Vagrant](https://www.vagrantup.com) gives you Virtual Machines in minutes while Docker gives you Virtual Containers in seconds.
86+
87+
[Vagrant](https://www.vagrantup.com) creates Virtual Machines in minutes while Docker creates Virtual Containers in seconds.
6188

6289
Instead of providing a full Virtual Machines, like you get with Vagrant, Docker provides you **lightweight** Virtual Containers, that share the same kernel and allow to safely execute independent processes.
6390

91+
In addition to the speed, Docker gives tens of features that cannot be achieved with Vagrant.
92+
93+
Most importantly Docker can run on Development and on Production (same environment everywhere). While Vagrant is designed for Development only, (so you have to re-provision your server on Production every time).
94+
95+
96+
<a name="laradock-vs-homestead"></a>
97+
### LaraDock VS Homestead
98+
99+
LaraDock and [Homestead](https://laravel.com/docs/master/homestead) both gives you a complete virtual development environments. (Without the need to install and configure every single software on your own Operating System).
100+
101+
- Homestead is a tool that controls Vagrant for you (using Homestead special commands). And Vagrant manages your Virtual Machine.
102+
103+
- LaraDock is a tool that controls Docker for you (using Docker Compose official commands). And Docker manages you Virtual Containers.
104+
105+
Running a virtual Container is much faster than running a full virtual Machine.
106+
<br>Thus **LaraDock is much faster than Homestead**.
64107

65108
<a name="Supported-Containers"></a>
66109
## Supported Containers
67110

68-
- PHP
111+
- PHP (7.0 - 5.6 - 5.5)
69112
- NGINX
113+
- Redis
70114
- MySQL
71115
- PostgreSQL
72-
- Redis
116+
- MariaDB
117+
- Beanstalkd
118+
- Beanstalkd Console
73119
- Data Volume
74120

121+
Cannot find your container! we would love to have it as well. Consider contributing your container and adding it to this list.
122+
123+
124+
75125
<a name="Requirements"></a>
76126
## Requirements
77-
- Laravel ([Download](https://laravel.com/docs/master/installation))
78-
- Docker Toolbox ([Download](https://www.docker.com/toolbox))
79-
- Git ([Download](https://git-scm.com/downloads))
80-
- Composer ([Download](https://getcomposer.org/download/))
127+
128+
| Linux | Windows & MAC |
129+
|-----------------------------------------------------------------------------------------|---------------------------------------------------------|
130+
| [Laravel](https://laravel.com/docs/master/installation) | [Laravel](https://laravel.com/docs/master/installation) |
131+
| [Git](https://git-scm.com/downloads) | [Git](https://git-scm.com/downloads) |
132+
| [Docker Engine](https://docs.docker.com/engine/installation/linux/ubuntulinux/#install) | [Docker Toolbox](https://www.docker.com/toolbox) |
133+
| [Docker Compose](https://docs.docker.com/compose/install) | |
134+
81135

82136
<a name="Installation"></a>
83137
## Installation
@@ -88,7 +142,7 @@ Instead of providing a full Virtual Machines, like you get with Vagrant, Docker
88142
git clone https://github.com/LaraDock/laradock.git docker
89143
```
90144

91-
Instead of `git clone` you can use `git submodule add` in case you are already using Git for your Laravel project *(Recommended)*:
145+
You can use `git submodule add` instead of `git clone` if you are already using Git for your Laravel project *(Recommended)*:
92146

93147
```bash
94148
git submodule add https://github.com/LaraDock/laradock.git docker
@@ -97,12 +151,15 @@ git submodule add https://github.com/LaraDock/laradock.git docker
97151
>These commands should create a `docker` folder, on the root directory of your Laravel project.
98152
99153

154+
155+
100156
<a name="Usage"></a>
101157
## Usage
102158

103-
>**(Windows & MAC users)** Make sure you have a running Docker Virtual Host on your machine first.
104-
><br>
105-
>[How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host)
159+
0 - For **Windows & MAC** users only: make sure you have a running Docker Virtual Host on your machine.
160+
(**Linux** users don't need a Virtual Host, so skip this step).
161+
<br>
162+
[How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host)
106163

107164

108165
<br>
@@ -121,18 +178,18 @@ DB_HOST=xxx.xxx.xxx.xxx
121178
> Running PHP, NGINX and MySQL:
122179
123180
```bash
124-
docker-compose up -d php nginx mysql
181+
docker-compose up -d php nginx mysql redis
125182
```
126183

127184
Note: you can choose your own combination of software's (containers), another example:
128185

129186
> Running PHP, NGINX, Postgres and Redis:
130187
131188
```bash
132-
docker-compose up -d php nginx postgres redis
189+
docker-compose up -d php nginx beanstalkd postgres
133190
```
134191

135-
Supported Containers: `php`, `nginx`, `mysql`, `postgres`, `redis`, `data`.
192+
Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `beanstalkd`, `beanstalkd-console`, `data`, `php`.
136193

137194
<br>
138195
3 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`).
@@ -172,10 +229,12 @@ docker-compose stop
172229

173230
To stop single container do:
174231

175-
```php
232+
```bash
176233
docker-compose stop {container-name}
177234
```
178235

236+
237+
179238
<br>
180239
<a name="Delete-all-existing-Containers"></a>
181240
#### Delete all existing Containers
@@ -197,10 +256,10 @@ If you do any change to any `dockerfile` make sure you run this command, for the
197256
```bash
198257
docker-compose build
199258
```
200-
Optionally you can specify which container to rebuild (instead of rebuilding all the containers), example rebuilding `PHP`:
259+
Optionally you can specify which container to rebuild (instead of rebuilding all the containers):
201260

202261
```bash
203-
docker-compose build php
262+
docker-compose build {container-name}
204263
```
205264

206265

@@ -273,7 +332,11 @@ Supported Versions:
273332

274333
For more details visit the [official PHP docker images](https://hub.docker.com/_/php/).
275334

335+
3 - Finally rebuild the container
276336

337+
```bash
338+
docker-compose build php
339+
```
277340

278341

279342
<br>
@@ -346,26 +409,20 @@ server_name laravel.dev;
346409
The Log files are stored in the `docker/logs` directory.
347410

348411

412+
413+
349414
<br>
350415
<a name="Enter-Container"></a>
351416
#### Enter a Container (SSH into a running Container)
352417

353418
1 - first list the current running containers with `docker ps`
354419

355-
2 - enter any container with:
356-
357-
Example: enter the `php` container
420+
2 - enter any container using:
358421

359422
```bash
360-
docker exec -it php bash
423+
docker exec -it {container-name-or-id} bash
361424
```
362-
363-
Example: enter the `nginx` container
364-
365-
```bash
366-
docker exec -it nginx bash
367-
```
368-
425+
3 - to exit a container, type `exit`.
369426

370427

371428
<br>
@@ -375,6 +432,7 @@ To prevent a container (software) from running, open the `docker-compose.yml` fi
375432

376433

377434

435+
378436
<br>
379437
<a name="Edit-a-Docker-Image"></a>
380438
#### Edit a Docker Image

beanstalkd-console/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM php:latest
2+
3+
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
4+
5+
RUN apt-get update && apt-get install -y curl
6+
7+
RUN curl -sL https://github.com/ptrofimov/beanstalk_console/archive/master.tar.gz | tar xvz -C /tmp
8+
RUN mv /tmp/beanstalk_console-master /source
9+
10+
RUN apt-get remove --purge -y curl && apt-get autoclean && apt-get clean
11+
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
12+
13+
EXPOSE 2080
14+
15+
CMD bash -c 'BEANSTALK_SERVERS=$BEANSTALKD_PORT_11300_TCP_ADDR:11300 php -S 0.0.0.0:2080 -t /source/public'

beanstalkd/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM phusion/baseimage:latest
2+
3+
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
4+
5+
ENV DEBIAN_FRONTEND noninteractive
6+
ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
7+
8+
RUN apt-get update
9+
RUN apt-get install -y beanstalkd
10+
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
11+
12+
VOLUME /var/lib/beanstalkd/data
13+
14+
EXPOSE 11300
15+
16+
CMD ["/usr/bin/beanstalkd"]

docker-compose.yml

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
version: '2'
2+
23
services:
34

45
### Nginx Server Container ##################################
56

67
nginx:
78
build: ./nginx
8-
container_name: nginx
99
volumes_from:
1010
- php
1111
volumes:
@@ -19,7 +19,6 @@ services:
1919

2020
php:
2121
build: ./php
22-
container_name: php
2322
volumes:
2423
- ../:/var/www/laravel
2524
- ./logs/php/:/usr/local/var/log
@@ -30,17 +29,16 @@ services:
3029

3130
data:
3231
build: ./data
33-
container_name: data
3432
volumes:
3533
- /var/lib/mysql
36-
- /var/lib/postgresql/data
34+
- /var/lib/postgres
35+
- /var/lib/mariadb
3736
- /var/lib/redis
3837

3938
### MySQL Container #########################################
4039

4140
mysql:
4241
build: ./mysql
43-
container_name: mysql
4442
volumes_from:
4543
- data
4644
ports:
@@ -57,7 +55,6 @@ services:
5755

5856
postgres:
5957
build: ./postgres
60-
container_name: postgres
6158
volumes_from:
6259
- data
6360
ports:
@@ -69,14 +66,46 @@ services:
6966
links:
7067
- php
7168

69+
### MariaDB Container #######################################
70+
71+
mariadb:
72+
build: ./mariadb
73+
volumes_from:
74+
- data
75+
ports:
76+
- "3306:3306"
77+
environment:
78+
MYSQL_DATABASE: homestead
79+
MYSQL_USER: homestead
80+
MYSQL_PASSWORD: secret
81+
MYSQL_ROOT_PASSWORD: root
82+
links:
83+
- php
84+
7285
### Redis Container #########################################
7386

7487
redis:
7588
build: ./redis
76-
container_name: redis
7789
volumes_from:
7890
- data
7991
ports:
8092
- "6379:6379"
8193

94+
### Beanstalkd Container ####################################
95+
96+
beanstalkd:
97+
build: ./beanstalkd
98+
ports:
99+
- "11300:11300"
100+
privileged: true
101+
102+
### Beanstalkd-Console Container ############################
103+
104+
beanstalkd-console:
105+
build: ./beanstalkd-console
106+
ports:
107+
- "2080:2080"
108+
links:
109+
- beanstalkd
110+
82111
### Add more Containers below ###############################

mariadb/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM mariadb:latest
2+
3+
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
4+
5+
VOLUME /var/lib/mariadb
6+
7+
CMD ["mysqld"]
8+
9+
EXPOSE 3306

postgres/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM postgres:latest
22

33
MAINTAINER Ben M <git@bmagg.com>
44

5-
VOLUME /var/lib/postgresql/data
5+
VOLUME /var/lib/postgres
66

77
CMD ["postgres"]
88

0 commit comments

Comments
 (0)