When trying to create a network in docker-compose.yml :
version: "3.5"
networks:
frontend:
name: custom_frontend
driver: custom-driver-1
I faced to following issue:
ERROR: The Compose file './docker-compose.yml' is invalid because:
networks.frontend value Additional properties are not allowed ('name' was unexpected)
I was using Docker-compose version 1.17.1
This happened , because docker-compose
release, I was using (1.17.1) is not support version 3.5
(mentionned in docker-compose Yml file).
1.17.1 only supports up to 3.4:
How to fix it ?
You can run the following commands to upgrade docker-compose
to a newer/latest version, (for example 1.28.5
) :
curl -L https://github.com/docker/compose/releases/download/1.28.5/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
(The commands were copied from the releases page)
After upgrade, you can run docker-compose -f <your-compose-file> config
to check whether the compose file is valid. If your compose file is valid it’ll just print it out.