Frappe Docker V13: Email Queue stuck

Emails are stuck in the queue unless they are manually triggered via “Send Now” Button.

I had set up a multi-bench Frappe Docker Production instance.
I have configured Email Domain, Email Account(Default Sending)
Any email sent from a document is stuck in the Email Queue.
However clicking manually using “Send Now” Button is able to send the mail

I have enabled scheduler and workers are also available.
Any idea to fix this issue.

Is this related?

There were no error logs found. I tried sending email with and without attachment.
However i could clear the queue only manually.
This site was perfectly working fine in VM. Recently i migrated the site to docker(same version of ERPNext and Frappe as that of VM) via backup restore.

Please find the compose file volume definition section. This is as per original frappe docker documentation. No modification done.

      volume: {}
networks:
  bench-network:
    name: lens-core-q
  mariadb-network:
    name: mariadb-network
    external: true
  traefik-public:
    name: traefik-public
    external: true
volumes:
  assets:
    name: lens-core-q_assets
  redis-data:
    name: lens-core-q_redis-data
  sites:
    name: lens-core-q_sites
x-backend-defaults:
  depends_on:
    configurator:
      condition: service_completed_successfully
  image: frappe/frappe-worker:v13.32.0
  volumes:
  - sites:/home/frappe/frappe-bench/sites
  - assets:/home/frappe/frappe-bench/sites/assets:ro
x-depends-on-configurator:
  depends_on:
    configurator:
      condition: service_completed_successfully
x-erpnext-backend-image:
  image: frappe/erpnext-worker:v13.33.0

compose file is incomplete

share one that was generated, like the one called gitops in example.

Below compose file was generated by executing

docker compose --project-name lens-core-q \
  --env-file ~/gitops/lens-core-q.env \
  -f compose.yaml \
  -f overrides/compose.erpnext.yaml \
  -f overrides/compose.redis.yaml \
  -f docs/compose/compose.multi-bench.yaml \
  -f docs/compose/compose.multi-bench-ssl.yaml config > ~/gitops/lens-core-q.yaml
name: lens-core-q
services:
  backend:
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/erpnext-worker:v13.33.0
    networks:
      bench-network: null
      mariadb-network: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
    - type: volume
      source: assets
      target: /home/frappe/frappe-bench/sites/assets
      read_only: true
      volume: {}
  configurator:
    command:
    - configure.py
    depends_on:
      redis:
        condition: service_started
    environment:
      DB_HOST: mariadb-database
      DB_PORT: "3306"
      REDIS_CACHE: redis:6379/0
      REDIS_QUEUE: redis:6379/1
      REDIS_SOCKETIO: redis:6379/2
      SOCKETIO_PORT: "9000"
    image: frappe/erpnext-worker:v13.33.0
    networks:
      bench-network: null
      mariadb-network: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
    - type: volume
      source: assets
      target: /home/frappe/frappe-bench/sites/assets
      read_only: true
      volume: {}
  frontend:
    depends_on:
      backend:
        condition: service_started
      websocket:
        condition: service_started
    environment:
      BACKEND: backend:8000
      FRAPPE_SITE_NAME_HEADER: $$host
      SOCKETIO: websocket:9000
      UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
      UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
      UPSTREAM_REAL_IP_RECURSIVE: "off"
    image: frappe/erpnext-nginx:v13.33.0
    labels:
      traefik.docker.network: traefik-public
      traefik.enable: "true"
      traefik.http.routers.lens-core-q-http.entrypoints: http
      traefik.http.routers.lens-core-q-http.middlewares: https-redirect
      traefik.http.routers.lens-core-q-http.rule: Host(`dev.nectar.lmnas.com`,`qnexindia.lmnas.com`,`qsgb.lmnas.com`)
      traefik.http.routers.lens-core-q-http.service: lens-core-q
      traefik.http.routers.lens-core-q-https.entrypoints: https
      traefik.http.routers.lens-core-q-https.rule: Host(`dev.nectar.lmnas.com`,`qnexindia.lmnas.com`,`qsgb.lmnas.com`)
      traefik.http.routers.lens-core-q-https.service: lens-core-q
      traefik.http.routers.lens-core-q-https.tls: "true"
      traefik.http.routers.lens-core-q-https.tls.certresolver: le
      traefik.http.services.lens-core-q.loadbalancer.server.port: "8080"
    networks:
      bench-network: null
      traefik-public: null
    volumes:
    - type: volume
      source: assets
      target: /usr/share/nginx/html/assets
      volume: {}
    - type: volume
      source: sites
      target: /usr/share/nginx/html/sites
      volume: {}
  queue-default:
    command:
    - bench
    - worker
    - --queue
    - default
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/erpnext-worker:v13.33.0
    networks:
      bench-network: null
      mariadb-network: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
    - type: volume
      source: assets
      target: /home/frappe/frappe-bench/sites/assets
      read_only: true
      volume: {}
  queue-long:
    command:
    - bench
    - worker
    - --queue
    - long
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/erpnext-worker:v13.33.0
    networks:
      bench-network: null
      mariadb-network: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
    - type: volume
      source: assets
      target: /home/frappe/frappe-bench/sites/assets
      read_only: true
      volume: {}
  queue-short:
    command:
    - bench
    - worker
    - --queue
    - short
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/erpnext-worker:v13.33.0
    networks:
      bench-network: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
    - type: volume
      source: assets
      target: /home/frappe/frappe-bench/sites/assets
      read_only: true
      volume: {}
  redis:
    image: redis:6.2-alpine
    networks:
      bench-network: null
      mariadb-network: null
    volumes:
    - type: volume
      source: redis-data
      target: /data
      volume: {}
  scheduler:
    command:
    - bench
    - schedule
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/erpnext-worker:v13.33.0
    networks:
      bench-network: null
      mariadb-network: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
    - type: volume
      source: assets
      target: /home/frappe/frappe-bench/sites/assets
      read_only: true
      volume: {}
  websocket:
    depends_on:
      configurator:
        condition: service_completed_successfully
    image: frappe/frappe-socketio:v13.32.0
    networks:
      bench-network: null
      mariadb-network: null
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
networks:
  bench-network:
    name: lens-core-q
  mariadb-network:
    name: mariadb-network
    external: true
  traefik-public:
    name: traefik-public
    external: true
volumes:
  assets:
    name: lens-core-q_assets
  redis-data:
    name: lens-core-q_redis-data
  sites:
    name: lens-core-q_sites
x-backend-defaults:
  depends_on:
    configurator:
      condition: service_completed_successfully
  image: frappe/frappe-worker:v13.32.0
  volumes:
  - sites:/home/frappe/frappe-bench/sites
  - assets:/home/frappe/frappe-bench/sites/assets:ro
x-depends-on-configurator:
  depends_on:
    configurator:
      condition: service_completed_successfully
x-erpnext-backend-image:
  image: frappe/erpnext-worker:v13.33.0

everything seems to be correct in yaml.

Try restarting the default queue container or the docker compose project.

Thanks @revant_one for taking a look at the yaml. I restarted the container, rebuilt the project. I cleared all the queue manually.
Even after doing all these, a new email triggered is again stuck in the queue.
FYI… This site was restored from a VM. Email was working perfect in the VM. After migrating to Docker we are facing this issue. All other sites also have the same problem.

Could you please share a sample yaml you have constructed so that i will use to compare if something is missing from my side.