Cannot connect to mongodb with tls

Hi, mongodb gurus,

I ran into a werid connection and spend a few hours and still cannot fix it.

I set up a mongod with tls enabled:
docker run -d --rm -v /mnt/mongodb:/data/db -v /etc/pki:/etc/ssl/mongo --network host --name mongodb mongo:4.2 mongod --replSet rs0 --auth --tlsMode requireTLS --clusterAuthMode x509 --tlsCertificateKeyFile /etc/ssl/mongo/tls/certs/test.pem --tlsCAFile /etc/ssl/mongo/ca.pem --bind_ip_all --logpath /data/db/mongo.log

then then mongo to connect to it:
docker run mongodb bash
mongo --tls --tlsAllowInvalidHostnames --tlsCertificateKeyFile /etc/ssl/mongo/tls/certs/test.pem --tlsCAFile /etc/ssl/mongo/ca.pem

and I got the error:
connecting to: mongodb://
2022-06-20T10:32:27.543+0000 E QUERY [js] Error: couldn’t connect to server, connection attempt failed: SocketException: internal error :
2022-06-20T10:32:27.545+0000 F - [main] exception: connect failed
2022-06-20T10:32:27.545+0000 E - [main] exiting with code 1

The weird part is that the whole thing works in my on-prem configuration but failed on azure. Selinux is permissive and fips is disabled. (Both seems irrelevant)

the log on server side is simply:
2022-06-20T10:32:31.722+0000 I NETWORK [listener] connection accepted from #9 (1 connection now open)
2022-06-20T10:32:31.723+0000 I NETWORK [conn9] end connection (0 connections now open)

The server side seems ok. How can we get more meaningful error messages?


Further info:

disabled tls and everythig is fine.

certificate are verified with no problem.

Both mongod and mongo are run in official mongo:4.2 docker on redhat 7.9.

Tried 5.0 and everyting works smoothly. However, the up application is from 3rd and it depends on 4.2. Is it a bug?

Turned install with rpm installed of docker and everything is fine.