Skip to content

Commit 457c5d4

Browse files
committed
update the readme file
Support selecting your own containers in the docker compose command.
1 parent 22f11e0 commit 457c5d4

2 files changed

Lines changed: 44 additions & 22 deletions

File tree

README.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ Instead of providing a full Virtual Machines, like you get with Vagrant, Docker
6868
- PHP
6969
- NGINX
7070
- MySQL
71+
- Postgres
7172
- Redis
7273
- Data Volume
7374

74-
7575
<a name="Requirements"></a>
7676
## Requirements
7777
- Laravel ([Download](https://laravel.com/docs/master/installation))
@@ -114,23 +114,35 @@ DB_HOST=xxx.xxx.xxx.xxx
114114
[How to find my Docker IP Address?](#Find-Docker-IP-Address)
115115

116116
<br>
117-
2 - Run the containers:
117+
2 - Run the Containers, (you can select the software's (containers) that you wish to run)
118118
<br>
119-
*(Make sure you are in the `docker` folder before running this command)*
119+
*Make sure you are in the `docker` folder before running the `docker-compose` command.*
120+
121+
> Running PHP, NGINX and MySQL:
120122
121123
```bash
122-
docker-compose up -d
124+
docker-compose up -d php nginx mysql
125+
```
126+
127+
Note: you can choose your own combination of software's (containers), another example:
128+
129+
> Running PHP, NGINX, Postgres and Redis:
130+
131+
```bash
132+
docker-compose up -d php nginx postgres redis
123133
```
124134

125-
>*Only the first time you run this command, it will take up to 5 minutes (depend on your connection speed) to download the Docker Images on your local machine.*
126135

127136
<br>
128137
3 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`).
129138

130139

131-
> **Debugging**: in case you faced an error here, run this command from the Laravel root directory:
132-
> <br>
133-
> `sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache`
140+
<br>
141+
**Debugging**: in case you faced an error here, run this command from the Laravel root directory:
142+
143+
```bash
144+
sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache
145+
```
134146

135147
<br>
136148

@@ -172,17 +184,26 @@ docker-compose rm -f
172184
<br>
173185
<a name="Build-Re-build-Containers"></a>
174186
#### Build/Re-build Containers
187+
188+
If you do any change to any `dockerfile` make sure you run this command, for the changes to take effect:
189+
175190
```bash
176191
docker-compose build
177192
```
193+
Optionally you can specify which container to rebuild (instead of rebuilding all the containers), example rebuilding `PHP`:
178194

195+
```bash
196+
docker-compose build php
197+
```
179198

180199

181200
<br>
182201
<a name="Use-Redis-in-Laravel"></a>
183202
#### Use Redis in Laravel
184203

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.
204+
1 - First make sure you run the Redis Container with the `docker-compose` command.
205+
206+
2 - Open your Laravel's `.env` file and set the `REDIS_HOST` to your `Docker-IP` instead of the default `127.0.0.1` IP.
186207

187208
```env
188209
REDIS_HOST=xxx.xxx.xxx.xxx
@@ -201,26 +222,27 @@ If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the datab
201222
],
202223
```
203224

204-
To enable Redis Caching and/or for Sessions Management. Also from the `.env` file set `CACHE_DRIVER` and `SESSION_DRIVER` to `redis` instead of the default `file`.
225+
3 - To enable Redis Caching and/or for Sessions Management. Also from the `.env` file set `CACHE_DRIVER` and `SESSION_DRIVER` to `redis` instead of the default `file`.
205226

206227
```env
207228
CACHE_DRIVER=redis
208229
SESSION_DRIVER=redis
209230
```
210231

211-
Finally make sure you have the `predis/predis` package `(~1.0)` installed via Composer first.
232+
4 - Finally make sure you have the `predis/predis` package `(~1.0)` installed via Composer first.
212233

213234
```bash
214235
composer require predis/predis:^1.0
215236
```
216237

217-
You can manually test it with:
238+
5 - You can manually test it from Laravel with this code:
218239

219240
```php
220241
\Cache::store('redis')->put('laradock', 'awesome', 10);
221242
```
222243

223244

245+
224246
<br>
225247
<a name="Use-custom-Domain"></a>
226248
#### Use custom Domain (instead of the Docker IP)

docker-compose.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ services:
2828
links:
2929
- mysql
3030

31+
### DATA Container ##########################################
32+
33+
data:
34+
build: ./data
35+
container_name: data
36+
volumes:
37+
- /var/lib/mysql
38+
- /var/lib/postgresql/data
39+
- /var/lib/redis
40+
3141
### MySQL Container #########################################
3242

3343
mysql:
@@ -67,14 +77,4 @@ services:
6777
ports:
6878
- "6379:6379"
6979

70-
### DATA Container ##########################################
71-
72-
data:
73-
build: ./data
74-
container_name: data
75-
volumes:
76-
- /var/lib/mysql
77-
- /var/lib/postgresql/data
78-
- /var/lib/redis
79-
8080
### Add more Containers below ###############################

0 commit comments

Comments
 (0)