wordpress with mysql deployment instance periodically unreachable

I have a wordpress + mysql instance deployed on the server machine with nginx. At some point I noticed wordpress container periodically returning 500 or 302. No errors shown in the corresponding mysql instance logs. Sometimes refreshing the wordpress page a few times helps.

Here is docker-compose file used for the deployment. WordPress version: 6.0.2, MySQL: 8.0.33

version: '3.9'
services:
  wordpress:
    image: wordpress
    depends_on:
      - db
    restart: always
    ports:
      - 8083:80
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: "$DB_PASSWORD"
      WORDPRESS_DB_NAME: portal
    volumes:
      - /data/portal/wordpress:/var/www/html:Z

  db:
    image: mysql
    restart: always
    environment:
      MYSQL_DATABASE: portal
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: "$DB_PASSWORD"
      MYSQL_ROOT_PASSWORD: "***"
    volumes:
      - /data/portal/db:/var/lib/mysql:Z
networks:
  default:
    name: default_network

I have tried to update both wordpress and mysql to recent versions, deactivate all plugins and themes, increase PHP memory limits and redeploy everything from scratch removing all the data from volumes, nothing so far helped to fix the issue. Any thoughts about where to look for the possible source of this problem?