简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM