Du Ji was from Duling County (), Jingzhao Commandery (), which is in present-day southeastern
Xi'an,
Shaanxi. When he was 19, he served in the convict labour section under the magistrate of Zheng County (鄭縣; present-day
Hua County, Shaanxi). He personally saw all of the hundreds of convicts in the county prisons, weighed the severity of their transgressions, and despatched them to their labours accordingly. Following this, he was nominated as a
xiaolian and appointed as a
fucheng (府丞; an aide) in the
Hanzhong stores office. Towards the
end of the Han dynasty, Du Ji abandoned his post and fled south to
Jing Province (covering present-day
Hubei and
Hunan). He returned to the north sometime between 196 and 205, and was recommended to
Cao Cao by
Xun Yu. Du Ji was appointed as a Director of Justice () to under the
Minister of Works (then held by Cao Cao), then sent west to Xiping Commandery (西平郡; present-day
Xining,
Qinghai) to serve as the commandery's Administrator () and as Colonel Who Protects the
Qiang (). In 205,
Gao Gan, a northern warlord and adopted nephew of
Yuan Shao, rebelled against Cao Cao, to whom he had surrendered years earlier. Gao Gan convinced Wang Yi (), the Administrator of
Hedong Commandery (), to join him in the rebellion. Two other men from Hedong Commandery, Wei Gu () and Fan Xian (), claimed to have liberated cities for Cao Cao, while conspiring with Gao Gan. The loss of Hedong Commandery greatly troubled Cao Cao, who saw its strategic location as critical to controlling China, and worried that the rebels could cause serious harm if they were to ally with
Liu Biao, the Governor of
Jing Province, to their south. He asked Xun Yu to recommend him a great general the likes of
Xiao He or Kou Xun (), who substantially assisted the careers of the
Han dynasty emperors
Gaozu and
Guangwu respectively. Xun Yu cautiously recommended Du Ji. ==As the Administrator of Hedong Commandery==