Deploy RocketChat and MongoDB on different Hosts [Docker]

You need to expose the mongodb Port.

So in your case: docker run --name db -d mongo:4.0 --smallfiles --replSet rs0 --oplogSize 128 -p 192.168.56.22:27017:27017

After that, you can access mongodb on port 27017 via IP 192.168.56.22.