Hi Michael,
Since this is kind of a large and broad topic, its hard to give you a working solution, reading from your snippets.
In addition, Mendix has a good and detailed learning Path on how to build images from a private cloud.
https://academy.mendix.com/link/paths/101/Mendix-for-Private-Cloud
Ofcourse, you would like to have a working answer right away, but I think that following this learning path will do you better.
Good luck with it,
Jan
From time to time it seems Mendix forget's to include mxbuild. I am currently having the same problem with MX10.6.2, while MX10.5 has it included.