dongyihang3575 2017-11-16 18:16
浏览 165


I have the following docker-compose.yml file which runs nginx with PHP support:

version: '3'
    container_name: my-app-nginx
    image: nginx:1.13.6
      - 8080:80
      - ./nginx-default.conf:/etc/nginx/conf.d/default.conf
      - ./my-app:/var/www/my-app
    restart: always
      - php
    container_name: my-app-php
    image: php:7.1-fpm
      - ./my-app:/var/www/my-app
    restart: always

The PHP application inside /var/www/my-app needs to communicate with a linux daemon (let's call it myappd).

The way I see it, I need to either:

  1. Copy the myappd into the nginx container to /usr/local/bin, make it executable with chmod +x and run it in the background.
  2. Create a different container, copy myappd to /usr/local/bin, make it executable with chmod +x and run it in the foreground.

Now, I'm new to Docker and I'm researching and learning about it but my best guess, given that I'm using Docker Composer, is that option 2 is probably the recommended one? Given my limited knowledge about Docker, I'd have to guess that this container would require some sort of linux-based image (like Ubuntu or something) to run this binary. So maybe option 1 is preferred? Or maybe option 2 is possible with a minimal Ubuntu image or maybe it's possible without such image?

Either way, I have no idea how would I implement that on the composer file. Especially option 2, how would the PHP application communicate with the daemon in a different container? Just "sharing" a volume (where the binary is located) like I did for nginx/php services would suffice? Or something else is required?

  • 写回答

1条回答 默认 最新


      相关推荐 更多相似问题


      • ¥15 如何抓这个函数的包wx.updateShareMenu
      • ¥15 需要数据分析!时间紧!
      • ¥15 关于免费论文查重系统的问题。
      • ¥15 朋友们,这个sim函数是出了什么问题了呢
      • ¥15 【MRT数据导入问题】MRT处理modis数据提示opening input header file怎么解决?
      • ¥15 嵌入式系统综合设计题有会的教一下嘛?
      • ¥15 yolov5转onnx验证出错
      • ¥15 proteus仿真LCD不点亮
      • ¥15 C语言红绿灯时间问题
      • ¥15 matlab仿真实现定位算法