Answer the question
In order to leave comments, you need to log in
How to set up a container network with docker-compose?
There are a number of services in different folders, each of them has its own compose file.
Running docker-compose up creates two separate networks, br-xxxxxxxxxxxx and vethxxxxxx, from which the services described in the compose file get addresses. (It would be nice to cut out the veth that I don't need)
Ie . how many compose files, so many networks are created.
I would like to organize only one network for containers so that they see each other and address each other by name.
Answer the question
In order to leave comments, you need to log in
I use docker-compose file version 2
Manually create
network Add network description to each file
networks:
mynetwork:
external:
name: myglobalnetwork
services:
nginx:
build: ./nginx
networks:
mynetwork:
aliases:
- nginx.mynetwork
postgres:
build: ./postgres
networks:
mynetwork:
aliases:
- postgres.mynetwork
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question