Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@Merc, $template is your twig template path. $variables yes it is contain array. This contain variable you want to pass to your twig template, The View::TEMPLATE_MODE_SITE is option to identify Craft where they should search your template, so View::TEMPLATE_MODE_SITE is means is using the template folder you use normally. if you no need to render from twig template you can just put your html code inside the $html variable.
you can put the url on env variable, and that also hosts file should be applicable even you using docker, btw i think the answer from Mats Mikkel Rummelhoff is the answer how to setting the environment variable.
@AdrienneW for schema, do you use full schema or you create new one? if you created new one, do you have set your entry type to given schema? if it is possible can you give us screenshot about your field and schema.