Further to two good answers, using many scriptures, this is just to quote another two that are highly significant in casting light on the text in 1 Peter 3:8.
First, 1 Corinthians 2:12-16, the last verse being the point here. Paul says they have received, not the spirit of the world, but the spirit which is of God, in order to know what God has freely given them. The Holy Spirit gives them words of teaching. Such spiritual people are then asked a rhetorical question:
"For who hath known the mind of the Lord, that he may instruct him?
[Clearly, nobody] But we have the mind of Christ." (vs. 16)
Nobody can instruct God, but God has instructed them via the Holy Spirit so that they now know the mind of Christ. It is this "mind" they must remain united in sharing.
Second, Romans 12:1-16, about using gifts of service in the right way. Those who have had their minds renewed and so transformed to have the mind of Christ will have the same humble attitude. Again, verse 16 is the key point here:
"Be of the same mind one toward another. Mind not high things, but
condescend to men of low estate. Be not wise in your own conceits."
(vs. 16)
When those letters to Christians were being written, the congregations were fresh in their understanding of the doctrines of Christ, and no great apostasy had begun. There were warnings about certain groups trying to creep in, to corrupt with false teachings and practices, yes. But the Holy Spirit was guiding and leading those who did, indeed, keep the same mental attitude that was in Christ, that of humility. Indeed, that Philippians chapter 2 passage mentions the fellowship of the Spirit giving them that mind, which was also in Christ - a servant-attitude to others (vs.s 1-5).
Now, coming back to the verse in question, 1 Peter 3:8, it can be seen that "all having the one mind" would be shown in a humble, submissive attitude, being full of love and willingness to serve the others. It certainly would include believing the doctrines of Christ as given to them by the apostles, but a few verses on Paul continues this theme of being minded to humbly serve others:
"Forasmuch then that Christ hath suffered for us in the flesh, arm
yourselves likewise with the same mind: for he that hath
suffered in the flesh hath ceased from sin." (1 Peter 4:1) (Emphasis
mine)