This requires a different image in Docker. You can’t just use the postgres image and create an extension in it. Instead, you have to use the postgis image. This image will have a database in it already setup for you to use with postgis.
docker run --name docker-postgis -p 54321:5432 -v C:\docker\postgis:/var/lib/postgresql/data -e POSTGRES_PASSWORD=postgres -d postgis/postgis
If you need more info about how to setup Docker and PostgreSQL in general, see https://sqlkitty.com/docker-windows-persistent-postgresql/