Important: I'm writing this when the last version of macOS (and the one I have installed) is Mojave. There is already a script which installs Mojave in a virtual machine here https://github.com/img2tab/okiomov. But if you are curios how to do everything manually to install High Sierra, then this guide may be useful.
After reading a few articles I ended up with these steps:
- On macOS, download the High Sierra installer (even if you have Mojave installed): https://itunes.apple.com/us/app/macos-high-sierra/id1246284741?ls=1&mt=12
- If the High Sierra Installer starts, quit it.
- Open "Disk Utility".
- Click on "File" > "New Image" > "Blank image...". Or just press cmd+N.