Glassfish 5 not running in localhost

I am making my own Dockerfile with glassfish5. The glassfish5 has been download from the official web page http://download.oracle.com/glassfish/5.0/release/glassfish-5.0.zip. I have unzipped this file in the same folder with Dockerfile.
My Dockerfile looks as below:

FROM ubuntu

RUN apt-get update

RUN apt install openjdk-8-jre -y

ADD glassfish5 /opt/

EXPOSE 4848 8080 8181 9009

After that, I am building the image and opening with docker run -it gf5_web. Here I am going inside the path /opt/glassfish4/glassfish/bin and running the command ./asadmin start-domain. The response I am getting is:

Waiting for domain1 to start ...
Successfully started the domain : domain1
domain  Location: /opt/glassfish4/glassfish/domains/domain1
Log File: /opt/glassfish4/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.

However, when I try to open it from my local browser through localhost:4848 it doesn’t respond.

What am I possibly doing wrong?

I recommend exec’ing into the container (or continuing to use the interactive TTY you’ve shown for testing purposes), and checking which interface(s) are listening on port 4848. It’s fairly common for apps to listen on 127.0.0.1:. That works on servers/nodes, but not so well on containers, since the loopback interface is strictly ‘inside’. If this is indeed the problem, you’ll need to look at the glassfish configuration and make changes there to ensure the admin port is listening on a ‘public’ and routable interface in the container, restart the daemon, and that should get you moving forward.