This is based in this answer.
In my case the steps that produced the error where:
- Server restart, containers from a docker-compose stack remained stopped.
- Network prune ran, so the network associated with stack containers where deleted.
- Running
docker-compose --project-name "my-project" up -d failed with the error described in this topic.
Solved simply adding force-recreate, in this way:
docker-compose --project-name "my-project" up -d --force-recreate
This possibly works because with this containers are recreated linked with the also recreated network (previously pruned as described in the pre conditions).