Can access container via web browser but not from raw TCP connection

I can access my container from the web browser; but when I try to test connectivity using a tool like nc/ncat or any programming lanaguage; the connection fails. Is this expected behaviour? what I can do to work around?