Oh, man. Where do I begin?
The fundamental principle of hermaneutics (interpretation of scripture) is to interpret scripture with more scripture... particularly in immediate context, and scripture relating to similar subjects.
"Thou shalt not kill" needs context... not kill what? People? Sheep? Bugs? Microbes?
King David, in his early years at least, was "a man after God's own heart" who was a great warrior and war-leader, whose war-band killed tens of thousands of the enemy.
"If a thief be found breaking up, and smitten so that he die, no blood shall be shed for him." Killing a thief in the act of breaking and entering is not against OT Law.
Ask a Jew about the original Hebrew of the Big 10... they'll tell you "Thou shalt not kill" refers to unjustified or unlawful killing, not killing in war or in self-defense.
In the New Testament, when soldiers who had converted to Christianity came to Jesus and asked him what they should do, he said "do not terrorize the people, and be content with your pay" (ie don't harm innocent civilians or extort them). He didn't tell them to quit being soldiers.
Almost all Christian denominations recognize that there are many biblical exemptions to "thou shalt not kill", such as war and self-defense.
Very few denominations other than Quakers hold to a total non-violence philosophy.