Skip to content

Commit daa5ed9

Browse files
committed
Merge pull request laradock#32 from LaraDock/develop
Major Updates
2 parents 1205183 + 9ac7541 commit daa5ed9

12 files changed

Lines changed: 306 additions & 128 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/logs

README.md

Lines changed: 74 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
1515

1616

1717
- [Intro](#Intro)
18-
- [Supported Software (Docker Images)](#Supported-Software)
18+
- [Default Containers](#Default-Containers)
1919
- [Requirements](#Requirements)
20-
- [Screencast Tutorial](https://www.youtube.com/watch?v=jGkyO6Is_aI)
2120
- [Installation](#Installation)
2221
- [Usage](#Usage)
2322
- [Documentation](#Documentation)
2423
- [List current running Containers](#List-current-running-Containers)
2524
- [Close all running Containers](#Close-all-running-Containers)
2625
- [Delete all existing Containers](#Delete-all-existing-Containers)
26+
- [Build/Re-build Containers](#Build-Re-build-Containers)
2727
- [Use Redis in Laravel](#Use-Redis-in-Laravel)
2828
- [Use custom Domain](Use-custom-Domain)
2929
- [Change the PHP Version](#Change-the-PHP-Version)
3030
- [Add/Remove a Docker Container](#AddRemove-a-Docker-Container)
31-
- [Add Docker Images](#Add-Docker-Images)
31+
- [Add more Software's (Docker Images)](#Add-Docker-Images)
3232
- [Edit a Docker Container](#Edit-a-Docker-Container)
3333
- [View the Log files](#View-the-Log-files)
34-
- [Upgrade the Docker Images](#Upgrade-the-Docker-Images)
34+
- [Enter a Container (SSH into a running Container)](#Enter-Container)
3535
- [Edit a Docker Image](#Edit-a-Docker-Image)
3636
- [Run a Docker Virtual Host](#Run-Docker-Virtual-Host)
3737
- [Find your Docker IP Address](#Find-Docker-IP-Address)
@@ -62,20 +62,14 @@ Seriously!!!
6262
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.
6363

6464

65-
<a name="Supported-Software"></a>
66-
## Supported Software (Docker Images)
65+
<a name="Default-Containers"></a>
66+
## Default Containers
6767

68-
- PHP 5.6 / NGINX
69-
- PHP 5.5 / NGINX
68+
- PHP
69+
- NGINX
7070
- MySQL
7171
- Redis
72-
- Data Volume (for MySQL & Redis)
73-
- Beanstalked
74-
75-
76-
The Images links on [Github](https://github.com/LaraDock)
77-
<br>
78-
The Images links on [Docker Hub](https://hub.docker.com/u/laradock/)
72+
- Data Volume
7973

8074

8175
<a name="Requirements"></a>
@@ -88,12 +82,6 @@ The Images links on [Docker Hub](https://hub.docker.com/u/laradock/)
8882
<a name="Installation"></a>
8983
## Installation
9084

91-
What is better than watching a video tutorial!!
92-
<br>
93-
If you prefer watch this [screencast](https://www.youtube.com/watch?v=jGkyO6Is_aI), for how to install and use this tool.
94-
95-
<br>
96-
9785
1 - Clone the `LaraDock` repository, in any of your `Laravel` projects:
9886

9987
```bash
@@ -169,7 +157,6 @@ docker ps
169157
docker-compose stop
170158
```
171159

172-
173160
<br>
174161
<a name="Delete-all-existing-Containers"></a>
175162
#### Delete all existing Containers
@@ -182,18 +169,26 @@ docker-compose rm -f
182169
`docker stop {container-name}`
183170

184171

172+
<br>
173+
<a name="Build-Re-build-Containers"></a>
174+
#### Build/Re-build Containers
175+
```bash
176+
docker-compose build
177+
```
178+
179+
185180

186181
<br>
187182
<a name="Use-Redis-in-Laravel"></a>
188183
#### Use Redis in Laravel
189184

190-
Open your Laravel's `.env` file and set the `REDIS_HOST` to your `Docker-IP` instead of the default `127.0.0.1`.
185+
Open your Laravel's `.env` file and set the `REDIS_HOST` to your `Docker-IP` instead of the default `127.0.0.1` IP.
191186

192187
```env
193188
REDIS_HOST=xxx.xxx.xxx.xxx
194189
```
195190

196-
If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the database config file `config/database.php` and replace the `127.0.0.1` with your `Docker-IP` for Redis like this:
191+
If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the database config file `config/database.php` and replace the default `127.0.0.1` IP with your `Docker-IP` for Redis like this:
197192

198193
```php
199194
'redis' => [
@@ -215,10 +210,16 @@ SESSION_DRIVER=redis
215210

216211
Finally make sure you have the `predis/predis` package `(~1.0)` installed via Composer first.
217212

218-
```shell
213+
```bash
219214
composer require predis/predis:^1.0
220215
```
221216

217+
You can manually test it with:
218+
219+
```php
220+
\Cache::store('redis')->put('laradock', 'awesome', 10);
221+
```
222+
222223

223224
<br>
224225
<a name="Use-custom-Domain"></a>
@@ -240,54 +241,47 @@ Example:
240241
DB_HOST=xxx.xxx.xxx.xxx
241242
```
242243

243-
3 - Open the nginx config file `docker/settings/nginx/default` and add this in the `server`:
244+
3 - Open your browser and visit `{http://laravel.dev}`
244245

245-
```
246-
server_name laravel.dev;
247-
```
248246

249-
4 - Open your browser and visit `{http://laravel.dev}`
250247

248+
Optionally you can define the server name in the nginx config file, like this:
251249

252-
>In case you faced any problem, try this additional step:
253-
>
254-
>Open the `docker-compose.yml` and add the following to `php-nginx:`
255-
>
256-
>```yaml
257-
> extra_hosts:
258-
> - "laravel.dev:xxx.xxx.xxx.xxx"
259-
>```
250+
```
251+
server_name laravel.dev;
252+
```
260253

261254

262255

263256
<br>
264257
<a name="Change-the-PHP-Version"></a>
265258
#### Change the PHP Version
266-
By default **PHP 5.6** is running.
259+
By default **PHP 7.0** is running.
267260
<br>
268-
To change the default PHP version, simply open your `docker-compose.yml` file and edit this line:
269-
270-
```yaml
271-
image: laradock/php56nginx:latest
272-
```
273-
Supported versions:
261+
To change the default PHP version:
274262

275-
- (PHP 5.5.*) laradock/php55nginx:latest
276-
- (PHP 5.6.*) laradock/php56nginx:latest
263+
1 - Open the `dockerfile` of the `php` folder.
277264

265+
2 - Change the PHP version number in the first line,
278266

279-
**Note:** If you use this `laradock/phpnginx` image, it will pull from `laradock/php56nginx`.
267+
```txt
268+
FROM php:7.0-fpm
269+
```
280270

271+
Supported Versions:
281272

273+
- For (PHP 7.0.*) use `php:7.0-fpm`
274+
- For (PHP 5.6.*) use `php:5.6-fpm`
275+
- For (PHP 5.5.*) use `php:5.5-fpm`
282276

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

284279

285280
<br>
286281
<a name="Add-Docker-Images"></a>
287-
#### Add Docker Images
288-
*(add a software to run with other Containers)*
289-
<br>
290-
To add an image (software), just edit the `docker-compose.yml` and add your container details, to do so you need to be familiar with the [docker compose file syntax](https://docs.docker.com/compose/yml/).
282+
#### Add more Software's (Docker Images)
283+
284+
To add an image (software), just edit the `docker-compose.yml` and add your container details, to do so you need to be familiar with the [docker compose file syntax](https://docs.docker.com/compose/compose-file/).
291285

292286

293287

@@ -311,18 +305,26 @@ Example: if you want to set the MySQL port to 3333, just replace the default por
311305
The Log files are stored in the `docker/logs` directory.
312306

313307

308+
<br>
309+
<a name="Enter-Container"></a>
310+
#### Enter a Container (SSH into a running Container)
314311

312+
1 - first list the current running containers with `docker ps`
315313

316-
<br>
317-
<a name="Upgrade-the-Docker-Images"></a>
318-
#### Upgrade the Docker Images
314+
2 - enter any container with:
315+
316+
Example: enter the `php` container
317+
318+
```bash
319+
docker exec -it php bash
320+
```
319321

320-
By default `docker-compose.yml` is configured to use the latest stable version of the image (latest stable realease `tag`).
322+
Example: enter the `nginx` container
321323

324+
```bash
325+
docker exec -it nginx bash
326+
```
322327

323-
To use the latest build you can edit the `docker-compose.yml` file and replace the version number at the end of every image name with `:latest`
324-
<br>
325-
Example: change `image: laradock/mysql:0.1.0` to `image: laradock/mysql:latest`
326328

327329

328330
<br>
@@ -334,14 +336,19 @@ To prevent a container (software) from running, open the `docker-compose.yml` fi
334336

335337
<br>
336338
<a name="Edit-a-Docker-Image"></a>
337-
#### Edit a Docker Image (change some configuration in the image)
338-
To edit an image, and take full control of it:
339+
#### Edit a Docker Image
339340

340-
1. Clone any Image from [https://github.com/LaraDock](https://github.com/LaraDock)
341-
2. Modify the `Dockfile`
342-
3. Run `docker build -t {your-image-name} .`
341+
1 - Find the `dockerfile` of the image you want to edit,
342+
<br>
343+
example for `php` it will be `docker/php/dockerfile`.
343344

344-
All the images are open source and hosted on the [Docker Hub](https://hub.docker.com/u/laradock/).
345+
2 - Edit the file the way you want.
346+
347+
3 - Re-build the container:
348+
349+
```bash
350+
docker-compose build
351+
```
345352

346353
*If you find any bug or you have and suggestion that can improve the performance of any image, please consider contributing. Thanks in advance.*
347354

@@ -407,9 +414,8 @@ All Docker Images can be found at [https://github.com/LaraDock](https://github.c
407414

408415

409416

410-
#### Questions?
411-
[![Join the chat at https://gitter.im/LaraDock/laradock](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/LaraDock/laradock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
412-
417+
### Questions?
418+
If you have any question, send me a direct message on LaraChat, my username is `mahmoud_zalt`.
413419

414420

415421
## Credits

data/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM debian:jessie
2+
3+
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
4+
5+
CMD ["true"]

0 commit comments

Comments
 (0)