This is additional information about my question.
I found that QuarkusJpaConnectionProviderFactory.java is supposed to run Quarkus.asyncExit after the import, but that apparently doesn't work in my case.
Enabling debug logs did show that the function createMasterRealm() is indeed called and the import is successful. However, it then continues with starting an HTTP server instead of exiting the application.
docker exec -it kc-test-import /opt/jboss/keycloak/bin/kc.sh import --file /tmp/example.json --verbose '-Dquarkus.log.category.\"org.keycloak.connections.jpa.QuarkusJpaConnectionProviderFactory\".level=DEBUG'
... some line omitted ...
2021-05-26 09:23:31,845 INFO [org.key.url.DefaultHostnameProviderFactory] (main) Frontend: <request>, Admin: <frontend>, Backend: <request>
2021-05-26 09:23:31,851 DEBUG [org.key.con.jpa.QuarkusJpaConnectionProviderFactory] (main) Database info: {databaseUrl=jdbc:h2:file:/opt/jboss/keycloak/bin/..//data/keycloakdb, databaseUser=, databaseProduct=H2 1.4.197 (2018-03-18), databaseDriver=H2 JDBC Driver 1.4.197 (2018-03-18)}
2021-05-26 09:23:32,530 DEBUG [org.key.con.jpa.QuarkusJpaConnectionProviderFactory] (main) Database is up-to-date
2021-05-26 09:23:32,549 DEBUG [org.key.con.jpa.QuarkusJpaConnectionProviderFactory] (main) Calling migrateModel
2021-05-26 09:23:32,653 DEBUG [org.key.con.jpa.QuarkusJpaConnectionProviderFactory] (main) bootstrap
2021-05-26 09:23:32,653 DEBUG [org.key.con.jpa.QuarkusJpaConnectionProviderFactory] (main) bootstrap current transaction? true
2021-05-26 09:23:32,653 DEBUG [org.key.con.jpa.QuarkusJpaConnectionProviderFactory] (main) bootstrap current transaction status? 0
2021-05-26 09:23:32,682 INFO [org.key.pro.qua.QuarkusCacheManagerProvider] (main) Loading cluster configuration from /opt/jboss/keycloak/bin/../conf/cluster-default.xml
2021-05-26 09:23:32,975 INFO [org.inf.CONTAINER] (main) ISPN000128: Infinispan version: Infinispan 'Corona Extra' 11.0.9.Final
... some line omitted ...
2021-05-26 09:23:33,977 INFO [org.key.services] (main) KC-SERVICES0030: Full model import requested. Strategy: OVERWRITE_EXISTING
2021-05-26 09:23:33,977 INFO [org.key.exp.sin.SingleFileImportProvider] (main) Full importing from file /tmp/example.json
2021-05-26 09:23:34,106 INFO [org.key.exp.uti.ImportUtils] (main) Realm 'example' already exists. Removing it before import
2021-05-26 09:23:36,214 INFO [org.key.exp.uti.ImportUtils] (main) Realm 'example' imported
2021-05-26 09:23:36,409 INFO [org.key.services] (main) KC-SERVICES0032: Import finished successfully
2021-05-26 09:23:36,460 ERROR [org.key.services] (main) KC-SERVICES0010: Failed to add user 'admin' to realm 'master': user with username exists
2021-05-26 09:23:36,568 INFO [org.inf.man.DefaultCacheManager] (main) Stopping cache manager null on a3de9689a613-29279
2021-05-26 09:23:36,606 INFO [org.inf.CLUSTER] (main) ISPN000080: Disconnecting JGroups channel ISPN
2021-05-26 09:23:36,652 ERROR [org.key.cli.Picocli] (main) ERROR: Failed to start server using profile (none).
2021-05-26 09:23:36,652 ERROR [org.key.cli.Picocli] (main) ERROR: Details:: java.lang.RuntimeException: Unable to start HTTP server