Chinese authorities locked down Chengdu, a southwestern city of 21 million people, following a spike in COVID-19 cases.
Photos of empty supermarket shelves and Chengdu residents scrambling to hoard groceries went viral on social media with the order given only six hours before taking effect.
China is the last large economy wedded to a zero-COVID policy, stamping out virus flare-ups with snap shutdowns, mass testing, and lengthy quarantines.
Chengdu, in the southwest, became the latest city to announce a shutdown, saying in an official notice residents must “stay home in principle” from 6pm (10:00 GMT) on Thursday to combat a new wave of infections.
Each household will be allowed to send one person out to buy groceries and essential goods per day, provided they have tested negative in the previous 24 hours, it said.
All residents will be tested for the virus by Sunday, and it urged them not to leave the city unless “absolutely necessary”.
“The current state of epidemic control is abnormal, complex and grim,” the announcement said, adding the measures aimed to “decisively arrest the spread of the outbreak and guarantee the health of all citizens”.
Chengdu recorded 157 new local infections on Thursday, of which 51 displayed no symptoms, the city government said in a separate notice.
Children in at least 10 cities and provinces across China face disruptions to their new academic year as pandemic controls force schools to switch to online learning, according to a report in state-affiliated media.
Xining, the capital of western Qinghai province and home to 2.5 million people, rolled out a mass-testing drive and told residents in its main urban area to work from home for three days.
China has stuck to its zero-tolerance virus strategy despite concern the approach is stifling its economy.
Last month, travellers in the southern island province of Hainan protested after more than 80,000 tourists were stranded in a resort city because of a COVID-19 flare-up.