我正在学习如何将Docker与多个容器一起使用,而不是单个容器。
我想学习如何从容器A调用位于容器B上的程序。
(即:我希望能够从我的$ awk -F'[ ]' '{for(i=1;i<=NF;i++){if ($i=="") $i=" "; printf "%s", $i}}' <<< 'T h i s i s s o m e t e x t .'
This is some text.
$ awk -F'[ ]' '{for(i=1;i<=NF;i++){if ($i=="") $i=" "}}1' OFS= <<< 'T h i s i s s o m e t e x t .'
This is some text.
容器中调用sendmail
,而web
和类似程序位于sendmail
容器上。)
我有这个:
mailhog
但是,现在,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
,因为它位于/usr/sbin/sendmail
容器上。尝试使用PHP中的邮件功能会产生mailhog
错误。
如何链接这两个?
答案 0 :(得分:0)
容器需要位于同一网络中,这是我的问题。