Docker-compose: License unable to pick from variable, it is looking from different location

Hello folks,
A trying to install memSql inside a docker and added license with variable but am facing error for license since it is trying to fetch license from different location, have added there as well but still same, someone please help me

Error:
[root@ip-172-31-5-197 ec2-user]# docker-compose up
Recreating ec2-user_memsql_1 ... done
Attaching to ec2-user_memsql_1
memsql_1  | 2021-06-04 19:12:33.603004 Starting Cluster
memsql_1  | Latest errors from MemSQL tracelog:
memsql_1  | 63653323 2021-06-04 19:08:27.838  ERROR: open('/opt/singlestoredb-server-7.3.11-f7c82b8166/lib/license', O_RDONLY, S_IRUSR | S_IWUSR) failed. Error No such file or directory (2)
memsql_1  | 63653355 2021-06-04 19:08:27.838  ERROR: Cannot open license key file at '/opt/singlestoredb-server-7.3.11-f7c82b8166/lib/license'
memsql_1  | 270 2021-06-04 19:12:34.251 INFO: Log opened
memsql_1  | : Failed to connect to MemSQL: process exited: exit status 255
memsql_1  | Traceback (most recent call last):
memsql_1  |   File "/startup", line 122, in <module>
memsql_1  |     start_cluster()
memsql_1  |   File "/startup", line 86, in start_cluster
memsql_1  |     ctl("start-node", "--all")
memsql_1  |   File "/startup", line 18, in ctl
memsql_1  |     subprocess.check_output(["memsqlctl", "-yj"] + list(args)))
memsql_1  |   File "/usr/lib64/python2.7/subprocess.py", line 575, in check_output
memsql_1  |     raise CalledProcessError(retcode, cmd, output=output)
memsql_1  | subprocess.CalledProcessError: Command '['memsqlctl', '-yj', 'start-node', '--all']' returned non-zero exit status 1
ec2-user_memsql_1 exited with code 1

Yaml (docker-compose) file:

version: '2'

services:
  memsql:
    image: 'memsql/cluster-in-a-box'
    ports:
      - 3306:3306
      - 8080:8080
    environment:
      LICENSE_KEY: ${LICENSE_KEY}
      START_AFTER_INIT: 'Y'

Regards,
Vinay.

Unfortunately this is a common issue caused by the confusion of YAML syntax and docker-compose oddities. The environment variables must be provided as an array of key=value pairs like so:

    environment:
      - ROOT_PASSWORD=${ROOT_PASSWORD}
      - LICENSE_KEY=${LICENSE_KEY}
      - START_AFTER_INIT=Y

hey Carl,
Thanks for sharing. But that seems not working, am facing below error.
Error:
[root@ip-172-31-5-197 ec2-user]# docker-compose up
ERROR: The Compose file ‘./docker-compose.yaml’ is invalid because:
services.memsql.environment contains an invalid type, it should be an object, or an array

Below is my yaml records:
version: ‘2’

services:
memsql:
image: ‘memsql/cluster-in-a-box’
ports:
- 3306:3306
- 8080:8080
environment:
LICENSE_KEY=${LICENSE_KEY}
ROOT_PASSWORD=${ROOT_PASSWORD}
START_AFTER_INIT=Y

@gurramvinaychandra - please review docker-compose syntax which you can find here: https://docs.docker.com/compose/compose-file/

In this situation the issue is you are missing - in front of each env variable.