Docker:在其他容器中查找sendmail

我正在学习如何使用多个容器的Docker,而不是一个。

我想学习如何从容器A调用位于容器B上的程序。

(即:我想能够从我的web容器调用sendmail ,而sendmail和类似的程序位于mailhog容器。)

我有这个:

泊坞窗,compose.yml

 web: container_name: centosweb image: fab/centosweb ports: - "80:80" volumes: # Single files - ./config/httpd.conf:/etc/httpd/conf/httpd.conf # Directories - ./vhosts:/var/www/html - /Users/fabien/Dropbox/AppData/XAMPP/web/bilingueanglais/public_html:/var/www/html/bilingueanglais - ./logs/apache:/etc/httpd/logs # This will include access_log(s) and error_log(s), including PHP errors. links: - db:3306 - mailhog:1025 db: container_name: centosdb image: fab/centosdb hostname: db volumes: # Single files - ./config/my.cnf:/etc/my.cnf # Directories - ./mysqldata:/var/lib/mysql - ./logs/mysql:/var/log/mysql mailhog: image: mailhog/mailhog hostname: mailhog ports: - 1025:1025 - 8025:8025 

但是,现在, web无法find/usr/sbin/sendmail因为它位于mailhog容器中。 尝试从PHP使用邮件function会产生Could not instantiate mail function错误。

我怎样才能连接两个?