Create unordered list in render array
Use the theme 'item_list':

$content = [
  '#theme' =&gt; 'item_list',
  '#list_type' =&gt; 'ul',
  '#title' =&gt; 'My List',
  '#items' =&gt; ['item 1', 'item 2'],
  '#attributes' =&gt; ['class' =&gt; 'mylist'],
  '#wrapper_attributes' =&gt; ['class' =&gt; 'container'],
];          


The wrapper_attributes are not used in all themes. In core this is classy and bartik, which is based on classy.