Nextcloud 20 + MariaDB in Docker: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

Hello everyone,
please help me to understand the problem of installation Nextcloud 20 + MariaDB.

I’ve got the following docker-compose file:

version: '3.7'

services:

  reverse-proxy:
    image: traefik
    command:
      --providers.docker
      --accesslog=true
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: sql123
      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
    volumes:
      - db_data:/var/lib/mysql

  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    restart: always
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: sql123
      WORDPRESS_DB_NAME: wordpress
    volumes:
      - wp_data:/var/www/html
    labels:
      - "traefik.http.routers.wordpress.rule=Host(`host.local`)"

  db_nextcloud:
    image: mariadb
    restart: always
    environment:
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: nextcloud
      MYSQL_PASSWORD: sql123
      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
    volumes:
      - db_nextcloud_data:/var/lib/mysql

  nextcloud:
    depends_on:
      - db_nextcloud
    image: nextcloud:latest
    restart: unless-stopped
    environment:
      MYSQL_HOST: db_nexcloud
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: nextcloud
      MYSQL_PASSWORD: sql123
      NEXTCLOUD_ADMIN_USER: nextuser
      NEXTCLOUD_ADMIN_PASSWORD: next123
    volumes:
      - ~/proj1/nextcloud/html:/var/www/html:rw
      - ~/proj1/nextcloud/custom_apps:/var/www/html/custom_apps:rw
      - ~/proj1/nextcloud/config:/var/www/html/config:rw
    labels:
      - "traefik.http.routers.nextcloud.rule=Host(`host.local`) && PathPrefix(`/cloud`)"
      - "traefik.http.routers.nextcloud.middlewares=nextcloud-redirectregex, nextcloud-caldav, nextcloud-replacepath"
      - "traefik.http.middlewares.nextcloud-replacepath.stripprefix.prefixes=/cloud"
      - "traefik.http.middlewares.nextcloud-caldav.redirectregex.permanent=true"
      - "traefik.http.middlewares.nextcloud-caldav.redirectregex.regex=^https?://(.*)/.well-known/(card|cal)dav"
      - "traefik.http.middlewares.nextcloud-caldav.redirectregex.replacement=$${1}/remote.php/dav/"
      - "traefik.http.middlewares.nextcloud-redirectregex.redirectregex.regex=^(.*)/cloud$$"
      - "traefik.http.middlewares.nextcloud-redirectregex.redirectregex.replacement=$$1/cloud/"

volumes:
    db_data:
    db_nextcloud_data:
    wp_data:

When I kick off the containers, Nextcloud shows this in its logs:

Initializing nextcloud 20.0.0.9 ...
Initializing finished
New nextcloud instance
Installing with MySQL database
starting nextcloud installation
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
 ->
retrying install...
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
 ->
retrying install...
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
 ->
retrying install...

At the same time, there are no problems with Wordpress - it works with its database normally.

What is the root of the problem and how to fix it?