Unable to start Kibana in Docker Swarm

Hi I am trying to create kibana service in my local swarm environment, But unfortunately it consistently fails after giving Error: Optimizations failure Error.

My Kibana.yml file is as follows

version: '3'

services:
  kibana:
    image: docker.elastic.co/kibana/kibana:7.6.0
    deploy:
      mode: replicated
      replicas: 1
      resources:
        limits:
          memory: 4G
      restart_policy:
        condition: on-failure
        delay: 10s
        max_attempts: 3
    ports:
      - "5601:5601"
    environment:
      SERVER_NAME: "Development Kibana"
      XPACK_MONITORING_ENABLED: "true"
      XPACK_SECURITY_ENABLED: "true"
      ELASTICSEARCH_USERNAME: ""
      ELASTICSEARCH_PASSWORD: ""
      SERVER_PORT: "5601"
      ELASTICSEARCH_HOSTS: "http://elasticserver"
    volumes:
      - kibana:/usr/share/kibana/data
    networks:
      - balance
      
networks:
  balance:
    driver: overlay
    
volumes:
  kibana:

and it failed after giving following error

        {"type":"log","@timestamp":"2020-04-28T05:37:19Z","tags":["fatal","root"],"pid":6,"message":"{ Error: Optimizations failure.\n   6583 modules\n    \n    ERROR in ./x-pack/legacy/plugins/canvas/public/components/app/index.js\n    Module not found: Error: Can't resolve 'plugins/interpreter/canvas/load_legacy_server_function_wrappers' in '/usr/share/kibana/x-pack/legacy/plugins/canvas/public/components/app'\n    \n    ERROR in ./x-pack/legacy/plugins/canvas/public/lib/run_interpreter.js\n    Module not found: Error: ...
    FATAL  Error: Optimizations failure.,
       6583 modules,
        ,
        ERROR in ./x-pack/legacy/plugins/canvas/public/components/app/index.js,
        Module not found: Error: Can't resolve 'plugins/interpreter/canvas/load_legacy_server_function_wrappers' in '/usr/share/kibana/x-pack/legacy/plugins/canvas/public/components/app',
        ,
        ERROR in ./x-pack/legacy/plugins/canvas/public/lib/run_interpreter.js,
        Module not found: Error: Can't resolve 'plugins/interpreter/canvas/load_legacy_server_function_wrappers' in '/usr/share/kibana/x-pack/legacy/plugins/canvas/public/lib',

I tried multiple settings like but it always failed

    XPACK_SECURITY_ENABLED: "false"
    XPACK_GROKDEBUGGER_ENABLED: "false"
    XPACK_ML_ENABLED: "false"
    XPACK_INFRA_ENABLED: "false"
    XPACK_GROKDEBUGGER_ENABLED: "false"
    XPACK_SEARCHPROFILER_ENABLED: "false"
    XPACK_LICENSE_MANAGEMENT_ENABLED: "false"

The optimization failure usually shows up if you are resource limited. Can you remove the optimize folder, add allocate more CPU to the docker container and run again?