Can I use Docker-Compose to create Networks without Containers

docker-compose-networks.yml:

version: '3.7'

services:
    works:
        image: scratch
        restart: always
        container_name: net_works
        deploy:
            placement:
                constraints:
                    - "node.hostname==scratch"
        networks:
            - mynet1
            - mynet2

networks:
    mynet1:
        name: mynet1
        driver: overlay
        attachable: false
    mynet2:
        name: mynet2
        driver: overlay
        attachable: true

There's a check inside of docker-compose for whether the network is used, and if it's unused, it skips creating the network:

$ cat docker-compose.net-only.yml
version: '2'

networks:
  test1:
  test2:

$ docker-compose -f docker-compose.net-only.yml --verbose up
.....
WARNING: compose.network.from_services: Some networks were defined but are not used by any service: test1, test2
.....

$ docker network ls | grep test

$

I'd recommend doing this as a small shell script, calling docker network create instead of trying to use docker-compose for this task.