Dreams are related to reality, prisons, and prisoners-all of which represent punishment for doing wrong. You dream that you are a prisoner, which may indicate whether you have done something wrong or a decision in reality, but then you feel very guilty and should not do so. This kind of remorse is deeply hidden in the subconscious. When dreaming, people's rationality gradually weakens, so the subconscious breaks through the defense of rationality through camouflage, thus producing dreams. In your dream, the subconscious was originally self-reproach and guilt. In disguise, he became a prison or something related to prison to judge himself.
What I said may not be accurate, but you can recall what happened in reality before you had this dream and your own views on these things. In this way, it is not difficult to find the answer by connecting with practice.