The 22-year-old sepoy allegedly opened fire on two havildars from West Bengal and Maharashtra in the early hours of Monday, the police official said.
The sepoy, who has been serving in the Army for four years, had fled from the scene leaving behind his service weapon, but was caught later.
Officials are trying to ascertain what led to the firing.
A Naik-rank Army official, in a complaint filed with the police, said they heard gun shots when they were sleeping.
He, along with his colleagues, immediately informed their seniors about the incident and the injured were taken to a hospital in Pathankot where they were declared dead by doctors.
A massive manhunt was launched by police and Army personnel and the accused was caught a few kilometers away from the cantonment, the police official said.
A case of murder under relevant sections of the IPC and the Arms Act has been registered, he said.
(Except for the headline, this story has not been edited and is published from a syndicated feed.)