Upgrading to Unified Alerts in a Docker-hosted Grafana instance?

I’m hosting a Grafana (v8.4.1) instance on a Docker container, which currently holds company-facing dashboards and data (with associated legacy alerts and alert channels). I’d like to update the alert system to the new unified alerting method so that I can (hopefully) start improving the messages sent through alert channels with annotations and labels, without losing any configurations or data already present on the Grafana instance.

However, the procedure for updating Grafana to use unified alerts is described mentioned in the documentation (Opt-in to Grafana alerting | Grafana documentation) as editing the custom configuration file, which normally is inaccessible from outside the Docker container.

Does anyone happen to have had experience updating a Docker-hosted Grafana instance to convert from legacy alerts to unified alerts? If so, how?

There are many ways to do that, but I use environment vars for all the configuration instead of a config file. Just set these two env vars in your docker command or your docker compose file if you use that:
If you want to use a config file you can copy a custom file into your container in the Dockerfile using the Docker COPY command, like this:
COPY config.ini /etc/grafana/config.ini
Or you may have the config file in a Docker volume on the host machine, change the config and restart the container.

@erlfos hanks for the advice.

If I set these env vars and restart the container, will all the alerts already existing inside the container automatically be updated?

Update - looks like that indeed worked. Thank you to @erlfos for the assist.