On Docker version 20.10.17 the container name for the database is otree_docker-database-1 while in entrypoint.sh it is set to otree_docker_database_1. Solution would be to use container_name and hostname in docker-compose to have static names for the containers.