In a word: Don’t.
By all means, play a barbarian who has trouble controlling his temper, or behaves wildly differently while angry versus not. That is great stuff, true to the class and to the narrative precedents that have led to the barbarian being written. But don’t cede control over the character to some pre-ordained idea of how they are “supposed to” behave.
There are many very good reasons why the barbarian class does not require the barbarian to rage at anything. Some of those are simple balance reasons—sometimes raging is the wrong choice, and sometimes even if it’d be good, rage needs to be saved up for more important things. I would generally call these kinds of concerns fairly important—but on this subject, they are really quite minor, relatively speaking.
That is because those concerns pale in the face of the social problems that a character of this sort causes. This type of character tends to cause strife and arguments at the table. It tends to sap everyone’s enjoyment of the game—excepting, perhaps, the barbarian’s player, but sometimes not even they are exempted. Many gamers have found themselves in a position where they feel that they “have to” or “are supposed to” behave in certain ways, even if it makes everyone at the table unhappy, that player included.
And a character like this is all-too-easily sucked into that trap, because they are presented in an absolutist way. You describe the character as unable to control their rage. You even go so far as to say the character loses sight of who is friend and foe! That isn’t a part of the barbarian class at all! As presented, this character must react in a certain way to things—worse, this character must react the same way to many things. That is very likely going to make the character one-dimensional and annoying, both for his-or-her player and the other players at the table.
There are good ways to play a character like this, that can sometimes be actively detrimental to the party. There are ways to handle it in moderation, to use good judgment to play the character in a way that feels true, but simultaneously fun and engaging and appreciated by the players. Because that’s the main thing—behavior that makes the characters’ lives more difficult and frustrating can be OK, even laudable and interesting—but behavior that makes the players’ lives more difficult and frustrating is not.
And I would say that this is pretty difficult stuff to get right. It takes knowing the game, knowing the other players, knowing how to role play, and so on and so forth. Judgment like that takes time to build—particularly since it’s going to vary at every table. This is not the kind of character you introduce to a new group that doesn’t know you. Some groups won’t even let you—trust that you know how to handle such a character without aggravating everyone at the table has to be earned, in the eyes of some. (And realistically, when this is done poorly, it puts the other players in a rather awkward position where a character like yours isn’t safe to be around, so being “true” to your character forces them to either ignore their own characters—or else abandon, institutionalize, or euthanize your character.)
So my strongest suggestion, which really cannot be understated, remains Don’t. Not for your first character. Probably not for your second or third, either. Get to know the group, the game, and so on before considering it. And when you do it, make sure you do these things:
Absolutely get buy-in from every other player in the game. Not just the DM—everyone. When someone sits down to play D&D 5e, they have certain expectations about the game—and that includes, per the rules, that the barbarian has some control over their rage, at least to the point where they can avoid raging at the drop of a hat, and even while raging are still able to tell friend from foe. Introducing a character that flouts those expectations changes the game for them. It is not fair to them to change the game they are playing without so much as asking. Make sure everyone is comfortable with it.
Understand the differences between a game and a story. Many things that work in stories don’t work in games (and, to an extent, vice versa). Yes, roleplaying games are a matter of telling a story, but there are some restrictions on the story for the sake of the game. It’s hard to be hard-and-fast here, and some systems go out of their way to flout some of them in order to tell certain stories (e.g. D&D generally has all the players roughly balanced in power so they can feel equal in the storytelling, making a character like, say, Gandalf difficult to play—but then there is a Doctor Who system that has one character play the Doctor, and the whole game is built around the power imbalance), but nonetheless there are limitations. Characters that cause the party huge problems are one of the more consistent examples of it—in a narrative, overcoming such difficulties can be a source of the heroes’ greatness. But that’s because you’re only reading it, not having to deal with it personally. There is a big difference—you need to understand it before doing this.
Read What is “my guy syndrome” and how do I handle it? and its answers, and understand the pitfalls here. In particular, definitely check out Rich Burlew’s Making Tough Decisions (which is also recommended in those answers), especially the Decide to React Differently section. Playing a character with absolute, mechanistic reactions to certain stimuli is straight-up bad for the game. You have to know when and how to moderate the character’s behavior—you have to know when behaving in a way that is superficially “true” to the character is bad for the game. Acting out of character is bad, but wrecking the game is a lot worse. And realistically, no one ever responds to things exactly the same way every time. No one’s reactions can be predicted with any real certainty. A character like that isn’t actually all that realistic or engaging. A skilled player can turn a decision to react differently into a high point for their role-playing—why a character reacts to something in a way that is surprising can often be far more interesting than the expected reaction. Think of all the scenes in the media the barbarian is based on where someone says or does something, and the whole party flinches and looks at the berserker, expecting him to explode—and he doesn’t, saying something like “Actually, I agree with him,” or “Ah, yes, this is a woman I respect!” or whatever. There are definitely examples of this out there—they’re there for a reason.
Get comfortable discussing issues at the table. Get comfortable, even, interrupting things if you need to. Get comfortable articulating your desires from the game, and understanding others’. These are not easy things to do (even in my regular gaming group of several years, getting some members to articulate likes or dislikes can be like pulling teeth), but they are crucially important. People can be very uncomfortable with this, not wanting to be picky or nagging or anything like that—but ultimately if you do not know how to talk with them, engage with them, and find out their feelings on matters despite that, you run the very real risk of ruining the game for them. And if you can’t communicate, you may not find out until they decide the game is no fun and not how they want to spend their time. Don’t do that.
Be ready, willing, and able to accept consequences for your behavior. Being “true” to a character awards you no points, gets you out of nothing. Expect and respect other characters for responding appropriately—even if that means this character is short-lived. Avoiding the character being short-lived takes a lot of skill and judgment and knowing how and when to decide to react differently, but if you are being problematic for the characters, it may be in-character for those characters to get rid of you. If you behavior in-character is what prompts other characters to want you gone, in-character, you really haven’t got a leg to stand on. You have to be mature enough to understand and respect that, and let it happen if it does.