ERROR: Service "xxx" uses an undefined network "xxx" ERROR: Service "xxx" uses an undefined network "xxx" docker docker

ERROR: Service "xxx" uses an undefined network "xxx"


You need to add this network to the Compose file as external network like this:

networks:  frontend-network:    external: true

You can read about this in the docks here: https://docs.docker.com/compose/compose-file/compose-file-v3/#external-1.


You need to create a user-defined network with:

docker network create etl_dev

After that, make sure you added it to the yaml with top-level networks:, which goes at the same level of services.

version: "3.9"networks:    etl_dev:        external: trueservices:    local_database:        image: postgres:12        networks:            - etl_dev        volumes:            - /home/local_postgres_data:/var/lib/postgresql/data        environment:            POSTGRES_USER_FILE: /run/secrets/etl_pg_usr_v1            POSTGRES_PASSWORD_FILE: /run/secrets/etl_pg_pass_v1

If you are using swarm, make sure you add -d overlayto the docker network create command. See Network docs.