duanlao1552 2018-12-14 17:13
浏览 99

从PhpStorm在docker上运行测试不会启动apache2

I managed to configure PhpStrom with docker based on php7.1-apache image. docker-compose.yml is below:

version: '3'

services:

  www:
    image: php:7.1-apache
    volumes:
      - .:/var/www/html/
    ports:
      - "80:80"

And in my app I have unit tests and api tests. There is no problem with running unit tests from phpstorm. Remote interpreter is being used correctly.

The problem is with api tests that make http requests to web-server. I figured out that apache2 daemon is not started at all.

docker ps --no-trunc shows:

php /var/www/html/vendor/phpunit/phpunit/phpunit --no-configuration --filter '/(::should_do_something)( .*)?$/' ExampleTest /var/www/html/tests/ExampleTest.php --teamcity

And in container I can see:

$:~/workspace/phpstorm-docker$ docker-compose exec www bash
root@aa13971914b2:/var/www/html/tests# service apache2 status
[FAIL] apache2 is not running ... failed!

That's because PhpStrom does not start apache2-foreground process.

If I put sleep(15) before api test execution and inside container run:

service apache2 start 

Test is passing.

Do you know how to make PhpStorm to start also apache2 web server to have complete container?

Thanks.

  • 写回答

1条回答 默认 最新

  • dpdhf02040 2018-12-19 21:48
    关注

    PhpStorm ignores the entrypoint when it starts containers via Docker Compose: https://youtrack.jetbrains.com/issue/WI-42228

    Probably adding command: service apache2 start to your docker-compose.yml would do the trick here.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看