solved by running metabase directly using jar file on a seperate machine. and passing environment variables ONLY worked by using -D
Example:
java -jar -DMB_DB_TYPE=mysql -DMB_DB_DBNAME=metabase -DMB_DB_PORT=3306 -DMB_DB_USER=my_db_username -DMB_DB_PASS=my_db_pass -DMB_DB_HOST=1.2.3.4 metabase.jar migrate release-locks
and then the normal run
java -jar -DMB_DB_TYPE=mysql -DMB_DB_DBNAME=metabase -DMB_DB_PORT=3306 -DMB_DB_USER=my_db_username -DMB_DB_PASS=my_db_pass -DMB_DB_HOST=1.2.3.4 metabase.jar