File tree Expand file tree Collapse file tree 4 files changed +41
-1
lines changed Expand file tree Collapse file tree 4 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 1
- Docker configuration to
1
+ Docker configuration to run a Symfony app.
2
2
3
3
## Run
4
4
5
5
docker-compose up -d
6
6
7
7
You can now visit http://localhost and see the default Symfony page.
8
+
9
+ ## Useful commands
10
+
11
+ Symfony commands:
12
+
13
+ docker-compose exec php bin/console
14
+
15
+
16
+ ## Included stuff
17
+
18
+ ### Xdebug
19
+
20
+ Making Xdebug working with Docker is quite tricky as there is currently a limitation to Docker for Mac
21
+ that prevents a container to make a request to the the host, which is exactly what we would like to do with Xdebug.
22
+
23
+ To make Xdebug debugging work, you will first need to run this command:
24
+
25
+ sudo ifconfig lo0 alias 10.200.10.1/24
26
+
27
+ This IP address is configured in the environment variables of the PHP container (see ` docker-compose.yml ` file).
28
+
29
+ No extra configuration is needed in your IDE (tested on Sublime Text, Visual Studio Code and Atom), apart the usual.
30
+
31
+ Interesting resources:
32
+
33
+ * https://docs.docker.com/docker-for-mac/networking/#/use-cases-and-workarounds
34
+ * http://blog.arroyolabs.com/2016/10/docker-xdebug/
35
+ * http://joenyland.me/blog/debug-a-php-app-in-a-docker-container-using-xdebug/
36
+
Original file line number Diff line number Diff line change @@ -4,8 +4,10 @@ services:
4
4
build : ./docker/php/
5
5
environment :
6
6
TIMEZONE : Europe/Paris
7
+ XDEBUG_REMOTE_HOST : 10.200.10.1
7
8
volumes :
8
9
- ./docker/php/php.ini:/usr/local/etc/php/conf.d/php.ini:ro
10
+ - ./docker/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini:ro
9
11
- ./app:/var/www/app
10
12
working_dir : /var/www/app
11
13
Original file line number Diff line number Diff line change @@ -38,3 +38,7 @@ RUN mv composer.phar /usr/local/bin/composer
38
38
RUN curl "https://phar.phpunit.de/phpunit.phar" -L -o "phpunit.phar"
39
39
RUN chmod +x phpunit.phar
40
40
RUN mv phpunit.phar /usr/local/bin/phpunit
41
+
42
+ # Xdebug
43
+ RUN pecl install xdebug \
44
+ && docker-php-ext-enable xdebug
Original file line number Diff line number Diff line change
1
+ xdebug.remote_enable = 1
2
+ xdebug.remote_autostart = 1
3
+ xdebug.remote_host = ${XDEBUG_REMOTE_HOST}
4
+ xdebug.remote_port = 9000
5
+ xdebug.remote_log =/var/log/xdebug/remote.log
You can’t perform that action at this time.
0 commit comments