What is a building which is occupied by the guard, and in which soldiers are confined for misconduct; hence, a lock-up called?

guardhouse — A building which is occupied by the guard, and in which soldiers are confined for misconduct; hence, a lock-up. (Webster's 1913.)

Sources