Problem with configuration on external drive

I tried to install nextcloud 17.0.1 on debian 10.
When I start docker-compose up in the /home/user directory everything works great.
But when I start docker-compose up on /cloud directory during configuration he receives such an error:

Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused

Cloud directory is on external drive (SATA), and home is on main drive.
I want to keep data in the same place until I have docker-compose.
If I have docker-compose on /cloud and data e.g. on /test it works.
And if I have docker-compose and date on /cloud it’s not work
What is the difference?