In the main you have already been answered on this topic Connection error when running MongoDB inside a container: connection refused - #2 by chris
You seem intent on rolling your own, look at the dockerfile linked in that post for inspiration.
Your next issue beyond that is one of platform compatibility. Look here for mongodb 4.2