Networks vs docker network command
by Jason.nix from LinuxQuestions.org on (#6KQ12)
Hello,
I have two YAML files like below:
Code:version: '3.9'
networks:
PHP:
driver: bridge
services:
php-fpm:
...And:
Code:version: '3.9'
networks:
Apache:
external: true
name: My_Net
services:
httpd:
...These containers can ping each other. If I remove the networks section from the above counters and use the following commands instead, are the two tasks the same?
Code:# docker network create My_Net
# docker network connect My_Net php-fpm
# docker network connect My_Net httpdI would be grateful if someone could clarify this issue.
Cheers.
I have two YAML files like below:
Code:version: '3.9'
networks:
PHP:
driver: bridge
services:
php-fpm:
...And:
Code:version: '3.9'
networks:
Apache:
external: true
name: My_Net
services:
httpd:
...These containers can ping each other. If I remove the networks section from the above counters and use the following commands instead, are the two tasks the same?
Code:# docker network create My_Net
# docker network connect My_Net php-fpm
# docker network connect My_Net httpdI would be grateful if someone could clarify this issue.
Cheers.