How to create/ modify a file in docker container ?
The same way that you would create / modify a file anywhere else… there is nothing special about a container in this regard. Perhaps if you explained what you are trying to accomplish we could give a more accurate reply.
Are you trying to modify a file from outside of the container? The best practice is to deploy containers that are immutable so you would want to modify the file while building the image and deploy a new immutable container from the modified image. But without knowing more about what you are trying to do, it is difficult to give you a specific answer.