Cannot access h2 database within docker container

I am trying to access h2 database via docker. It can be accessed successfully when running from IDE. I have tried multiple solutions which include

H2 DB in docker container

Creating docker volumes
Connecting to an H2 Database in a Docker Container

But I am not getting any success. Any help is much appreciated. Thank you.

Source: StackOverflow