On 22 May 1808, Luís Alves was enlisted at the age of five as a cadet in the 1st Regiment of Infantry of Rio de Janeiro. Historian Adriana Barreto de Souza explained that this did "not mean that he began to serve as a child, the connection to the regiment was simply honorific", his perquisite as the son of a military officer. This infantry regiment was informally known as the "Lima Regiment" because so many members of the family served in it, including his father and grandfather.