ERROR: The Compose file ‘./docker-compose.yml’ is invalid because:
services.jenkins.networks contains an invalid type, it should be an array, or an object
version: '3'
services:
jenkins:
container_name: jenkins
image: jenkins
ports:
- "8080:8080"
volumes:
- "$PWD/jenkins_home:/var/jenkins_home"
networks:
-net
networks:
net:
Docker-Compose – 1.26.0, build d4451659 ||
Jenkins for docker – Official Image ||
Linux Type – Cent-OS 7 minimal launched on AWS
2
Answers
try a space at line 11: – net instead of -net
using aliases would make your life easier.
at the bottom of the file making the network external would also keep the network when you do docker-compose down:
@aiman09 is also right about the space. Yml is very rigid with spaces .