我有三个Docker容器,一个运行着
我想使用php的
在我的docker-compose中,我已经编写了以下内容:
nginx
,另一个运行php
,第三个运行hashicorp的serf
。我想使用php的
exec
函数调用serf
二进制文件来触发serf事件
。在我的docker-compose中,我已经编写了以下内容:
version: '2'
services:
web:
restart: always
image: `alias`/nginx-pagespeed:1.11.4
ports:
- 80
volumes:
- ./web:/var/www/html
- ./conf/nginx/default.conf:/etc/nginx/conf.d/default.conf
links:
- php
environment:
- SERVICE_NAME=${DOMAIN}
- SERVICE_TAGS=web
php:
restart: always
image: `alias`/php-fpm:7.0.11
links:
- serf
external_links:
- mysql
expose:
- "9000"
volumes:
- ./web:/var/www/html
- ./projects:/var/www/projects
- ./conf/php:/usr/local/etc/php/conf.d
serf:
restart: always
dns: 172.17.0.1
image: `alias`/serf
container_name: serf
ports:
- 7496:7496
- 7496:7496/udp
command: agent -node=${SERF_NODE} -advertise=${PRIVATE_IP}:7496 -bind=0.0.0.0:7496
我在想,我可以做类似于php的这样一些事情:exec('serf serf event "test"')
,其中serf
是容器的主机名。
或者也许有人可以提供一些使用替代方法设置此类功能的想法?