Hello,
In a YAML file, two containers are defined, which are connected by using the links
option:
services:
nodejs:
container_name: Node
build:
context: .
dockerfile: Dockerfile
volumes:
- /var/www/html:/usr/share/nginx/html/
expose:
- "3000"
nginx:
image: nginx:latest
container_name: Nginx
ports:
- '80:80'
volumes:
- ./default.conf:/etc/nginx/conf.d/default.conf
- ./www:/usr/share/nginx/html
depends_on:
- nodejs
links:
- nodejs
Is it necessary to use the networks
option to connect these two containers? I am asking this question because I saw these two options together in a YAML file.
Cheers.