You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[How to find my Docker IP Address?](#Find-Docker-IP-Address)
115
115
116
116
<br>
117
-
2 - Run the containers:
117
+
2 - Run the Containers, (you can select the software's (containers) that you wish to run)
118
118
<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:
120
122
121
123
```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
123
133
```
124
134
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.*
126
135
127
136
<br>
128
137
3 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`).
129
138
130
139
131
-
> **Debugging**: in case you faced an error here, run this command from the Laravel root directory:
If you do any change to any `dockerfile` make sure you run this command, for the changes to take effect:
189
+
175
190
```bash
176
191
docker-compose build
177
192
```
193
+
Optionally you can specify which container to rebuild (instead of rebuilding all the containers), example rebuilding `PHP`:
178
194
195
+
```bash
196
+
docker-compose build php
197
+
```
179
198
180
199
181
200
<br>
182
201
<aname="Use-Redis-in-Laravel"></a>
183
202
#### Use Redis in Laravel
184
203
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.
186
207
187
208
```env
188
209
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
201
222
],
202
223
```
203
224
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`.
205
226
206
227
```env
207
228
CACHE_DRIVER=redis
208
229
SESSION_DRIVER=redis
209
230
```
210
231
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.
212
233
213
234
```bash
214
235
composer require predis/predis:^1.0
215
236
```
216
237
217
-
You can manually test it with:
238
+
5 - You can manually test it from Laravel with this code:
0 commit comments