ubuntuserver@ubuntu:~/Nginx-Reverse-Proxy/proxy$
ubuntuserver@ubuntu:~/Nginx-Reverse-Proxy/proxy$ cat docker-compose.yml
version: "2"
services:
proxy:
build:
context: ./
networks:
- example1
- example2
ports:
- 80:80
- 443:443
networks:
example1:
external:
name: example1_default
example2:
external:
name: example2_default
ubuntuserver@ubuntu:~/Nginx-Reverse-Proxy/proxy$
ubuntuserver@ubuntu:~/Nginx-Reverse-Proxy/proxy$ docker-compose build
ERROR: In file './docker-compose.yml', service 'networks' must be a mapping not an array.
ubuntuserver@ubuntu:~/Nginx-Reverse-Proxy/proxy$
Asked
Active
Viewed 224 times
0
![](../../users/profiles/38644.webp)
Gerald Schneider
- 19,757
- 8
- 52
- 79
1 Answers
0
You need to indent everything under proxy
one more level. Otherwise they are seen as different services.
services:
proxy:
build:
context: ./
networks:
- example1
- example2
ports:
- 80:80
- 443:443
![](../../users/profiles/38644.webp)
Gerald Schneider
- 19,757
- 8
- 52
- 79