LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Containers (https://www.linuxquestions.org/questions/linux-containers-122/)
-   -   Networks vs docker network command (https://www.linuxquestions.org/questions/linux-containers-122/networks-vs-docker-network-command-4175735448/)

Jason.nix 03-29-2024 06:41 AM

Networks vs docker network command
 
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 httpd

I would be grateful if someone could clarify this issue.

Cheers.

Jason.nix 03-30-2024 08:17 AM

Hello,
Yes, it is the same.

Thank you.


All times are GMT -5. The time now is 03:55 AM.