Are you getting your information from a movie? Courts Martial are made up of a judge and a 3-5 member panel who hear testimony and render verdicts. The judge is usually a Captain (O-6) with O-3 to O-5 grade officers at the table. If the accused is an Admiral or General, then the judge will be senior to the Admiral or General. JAGs (legal officers) represent the accused and represent the military. Similar to a prosecutor and defense attorney.
An accused enlisted member may request that a fellow enlisted member of equal or higher rate be on the panel. This is for Courts Martial only.
Commanding officers of any command or base who try to interfere with any trial, witnesses or anything else can get themselves in deep trouble and could face their own punishment.
The commanding officer of any command cannot conduct a Courts Martial, only Captain's Mast. He/she is limited by the UCMJ as to punishment levels. If the CO determines that the crime is severe enough, he can request the service member face a Courts Martial and forward the paperwork to the legal office. The accused may be allowed to stay at a command, be sent to a higher level command, or the brig to await trial.
Military personnel do not give up their rights. If we violate a rule or order while on duty at a base, port, wherever, then we may face a military punishment. We have legal representation, the same as a civilian.
If where you worked, you goofed off or failed to come into work, your boss would probably fire you. Military personnel are held to a higher standard.