How do I delete a CloudKit container?

Solution 1:

Apple's iOS CloudKit documentation: Enable iCloud and Select CloudKit

Important: When you select CloudKit, Xcode creates a default container ID based on the bundle ID. Because you can’t delete iCloud containers, verify that your bundle ID is correct in the General pane in Xcode before selecting CloudKit. To change your bundle ID, read Set the Bundle ID in App Distribution Quick Start.

Apple's macOS CloudKit documentation: About Containers and Databases

Multiple apps and users have access to iCloud, but data is segregated and encapsulated in partitions called containers. The containers belonging to your apps cannot be accessed by apps from another developer. However, your apps can share containers. Multiple apps can share the same container, and one app can use multiple containers. There’s one default container per app, but you can create additional custom containers. The identifier for the default container matches the app’s bundle ID. The other container IDs you specify need to be unique across all developer accounts. Containers can’t be deleted.

Solution 2:

You cant delete container currently. Best is to name containers App agnostic so you can reuse them later if needed for other Apps.

E.g: iCloud.com.mycompany.container1