Add fields to image upload option in CKEditor
Caption and alt text are not a good example because they are stored where the image is used, not together with the file entity. What you are looking for is File Entity to store the source data in a field of the image file. For new projects you shouldn't use it anymore, because it is deprecated in favor of the Media entity. Media is now in core and when the module is enabled you can add fields directly to the media type Image (/admin/structure/media/manage/image/fields).

Out of the box CKeditor does only provide a button to add file images, which you want to replace with Media. To add media types you need the module Entity Embed until this feature is integrated into core.