使用docker-compose实现服务
version: '3.6'
services:
redis:
image: redis
web:
image: cfanbo/swoole4_php7:v1
depends_on:
- redis
links:
- redis
volumes:
- /Users/sxf/sites/msgserve:/usr/src/myapp
command: "php src/push_server.php start"
容器环境为soole+php7
容器里的web目录为/usr/src/myapp,通过使用volumes来实现将物理机器上的目录挂载到窗口里,基中 php src/push_server.php start 是用swoole framework来搞的一个服务,需要依赖于redis容器。但 docker-compose up的时候,总是提示
msgserve_web_1 exited with code 0
Killing msgserve_redis_1 ... done
容器状态
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8a60af07101b cfanbo/swoole4_php7:v1 "docker-php-entrypoi…" Less than a second ago Exited (0) 13 seconds ago msgserve_web_1
20a803504037 redis "docker-entrypoint.s…" 19 minutes ago Up 14 seconds 6379/tcp msgserve_redis_1
另一个redis容器正常的,看日志是“ Server is already running.”的,这种情况下如何解决?
有时间修改运行脚本正常,但有时间不正常?