raju
raju

Reputation: 6936

Unable to give network name in docker-compose

I am trying to create a network in docker-compose.yml

version: "3.5"
networks:
  frontend:
    name: custom_frontend
    driver: custom-driver-1

it is giving error : ERROR: The Compose file './docker-compose.yml' is invalid because: networks.frontend value Additional properties are not allowed ('name' was unexpected)

Please help

docker-compose version 1.17.1, build unknown

Upvotes: 20

Views: 50563

Answers (1)

Yz.
Yz.

Reputation: 698

The compose file was fine. But as jonrsharpe mentioned, your docker-compose is not support version 3.5.

The releases page

You can run the following commands to upgrade docker-compose to 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.

Upvotes: 46

Related Questions