Yes, you need the definition of the network in the compose file, but docker compose will create an other network with the project name as prefix like: <projectname>_<networkname>. For example: myproject_test-wp-network. It’s fine and usually a good idea, but if you want to use the same network that you created without compose, that is an “external network”: Docker Compose documentation: external network