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
Manage a user-defined bridgeUse the docker network create command to create a user-defined bridge network. You can specify the subnet, the IP address range, the gateway, and other options. See the docker network create reference or the output of docker network create --help for details.
Pre-Existing Networks In this case, Docker Compose never creates the default network; instead connecting the app's containers to the i-already-created-this network.
If you want to add a container to a network after the container is already running, use the docker network connect subcommand. You can connect multiple containers to the same network. Once connected, the containers can communicate using only another container's IP address or name.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With