Shanghai’s Covid-19 lockdown has sent the city’s 25 million residents racing to grocery stores to stock up on vegetables, noodles and other quarantine essentials.

Then there’s Kent Kedl, an American expatriate in the Chinese megacity, who spent his last day of freedom outside, on his knees, digging up a boxful of dirt to bring home to his two dogs.

Stay! Good dog!

China’s zero-tolerance approach to crushing Covid outbreaks, and the severity of Shanghai’s latest wave of infections, has meant strict lockdowns for the denizens of China’s most cosmopolitan city. Except to undergo swab tests, everyone in the city was ordered to remain in their apartments in a rolling lockdown that was initially going to be for a handful of days. Many residents worry it will be extended past Tuesday.

That includes dog owners like Mr. Kedl, who hasn’t been able to walk his 140-pound Newfoundland, named Xiaoxiao (the name means “small-small”), or his Golden Labrador, Lala.

Last Thursday, members of his neighborhood committee, the grassroots-level rule enforcers in Chinese cities whose powers have only grown during the pandemic, showed up at his door with three rolls of grass sod for him to place on a balcony for his dogs to use as a canine port-a-potty.

Worried that Xiaoxiao and Lala wouldn’t get the hint, Mr. Kedl spent his final day before his section of the city was locked down retracing their daily walk with an empty box and a spade. After arriving at his dogs’ favorite patch of marked territory, he filled up a box of the familiar loam and went home to his apartment. There, he sprinkled the soil on a balcony to encourage his dogs to do their business there.

“They’re confused as heck,” said Mr. Kedl, who runs the Greater China operations of Control Risks, a London-based consulting firm. “You spend all these years training your dog not to do the thing you now really want them to do.”

Sudden changes in Covid rules over the past two years have prompted people all around the world to get creative in juggling work and home life. But Shanghai’s peculiarly restrictive conditions have brought additional challenges for the companions of the city’s more than 1 million registered canines, who were stunned by the lack of provisions for pet parents in the stay-at-home orders.

Kent Kedl digging up a box of soil to prepare for lockdowns in Shanghai.

Photo: Kent Kedl

Shanghai is one of China’s biggest and most densely packed cities, with many residents living in apartment towers and sprawling housing estates. In recent years, Shanghai’s four-legged residents have enjoyed a boom in new amenities, including pet-friendly restaurants and dog parks where they can run free and swim.

That all changed last week, when Wu Qianyu, an official with the Shanghai municipal health commission told citizens, in effect, that the quarantine rules apply equally to man and man’s best friend alike. That meant no setting foot outside apartment units, including corridors and parking lots—not for throwing out the garbage, not for jogging and not for walking pets.

As the implications of the dog lockdown became clear, pet owners spent their final hours of freedom stocking up on extra dog food and chew toys. Others collected leaves, dug up mulch and ordered patches of grass to set up “outdoor areas” in their homes.

Shanghai dogs and their owners participate in a virtual dog yoga session organized by pet-sitting startup Spare Leash.

Photo: Spare Leash

The founder of a local pet training academy held a live-streamed lesson on his social-media account to help owners train their dogs to get comfortable doing their business indoors. A Shanghai-based pet-sitting startup, Spare Leash, organized a virtual “doga”—that’s dog yoga—class for pets and their owners.

One local veterinarian, invited onto a local radio station to dispense advice to dog owners, counseled buying pet diapers and emphasized the importance of offering more emotional support to their animals.

Some have struggled to adapt. One video widely circulated among Shanghai dog owners showed a small white dog being lowered from an apartment block onto the grass below by a very long leash before doing its business.

Robert Gatti, an American expatriate in Shanghai, bought two big bags of fresh sod from a grass dealer, which he laid out in a few squares on his balcony. He then added some leaves he picked by hand from bushes outside his building for a pop of color and detail to recreate a park scene for his Shanghai rescue dog Xixi.

“My dog is from the streets,” Mr. Gatti said. “I think she can manage this.”

Xixi was happy to use some new sod as a place to enjoy the morning sun after lockdown began.

Photo: Robert Gatti

Heather Kaye, a New York City native who has lived in Shanghai for 16 years, isn’t so sure about Ruthie, her four-year-old mutt mix, who is used to walking about 3 miles each day.

Ms. Kaye, a fashion designer who is hunkering down with her husband and two adolescent daughters, had a roughly 10-square-foot patch of grass delivered a day before the lockdown.

Ruthie just stared at it, baffled. Rather than try to teach her old dog new tricks, Ms. Kaye called a municipal government hotline to leave messages pleading for more attention to dogs and their owners. The family has decided it’s time to move back home.

“I really get why [the government] did what they did for Delta but this is a totally different game now,” said Ms. Kaye, who described her move as motivated both by personal reasons and the Covid restrictions. “We love Shanghai but we cannot do this anymore. It’s too much.”

Ruthie trying out her patch of grass.

Photo: Heather Kaye

Ms. Kaye’s business partner, Indian expatriate Itee Soni, had spent recent weeks bringing her small dog Robyn, a three-year-old terrier, almost everywhere she went, including the office and the grocery stores, in case she was caught in one of China’s periodic snap lockdowns, which have trapped unwitting people in shopping malls and office towers for hours and even days after an infection or close contact was identified there.

Ms. Soni, who recalls earlier lockdowns in which dog-walking was permitted, said she tried to give Robyn a crash course in potty training as the lockdown approached. But delaying Robyn’s daily walks only seemed to stress her out, without the desired effect.

After preparing a “go bag” for Robyn filled with treats and lotion, then making arrangements to have Robyn stay with Ms. Kaye, Ms. Soni changed her mind the day before the lockdown began, rushing Robyn to a pet hotel a half-hour’s drive outside the city, fearing that she might test positive for Covid and be taken away by health officials, leaving Robyn home alone for an indefinite amount of time.

Picture of Robyn Itee Soni took for staff at a dog hotel. Ms. Soni decided to put Robyn at a dog hotel one day before the lockdown.

Photo: Itee Soni

“I’ve used up all my bandwidth thinking about Robyn’s safety,” Ms. Soni said. “This round of outbreak and lockdown really broke me a little.”

Mr. Kedl, the longtime American expatriate who dug up the familiar soil for his dogs Xiaoxiao and Lala, has found it harder going than he had expected.

On the first day of lockdown, the dogs seemed not to notice having missed their morning walk, but when the afternoon walk time came without any signs of motion, Mr. Kedl said, “their eyes started crossing and they were getting a little nervous.”

So Mr. Kedl, following the advice of one member of his Shanghai dog owners’ chat group, cordoned off the section of the balcony where he had set up the patch of grass, sprinkled with the soil he had scooped up, hoping to cultivate a sense of mystery around the faux-outdoor area.

Then, in line with the instructions he had read, when it was time for a walk, Mr. Kedl dutifully leashed up his two dogs, walked them the 10 steps to the secret “outdoor” area and just waited.

But rather than get on with it, Mr. Kedl’s two dogs sat down on the grass, blinking bemusedly at him.

“They were questioning my sanity,” Mr. Kedl said. “And I’m not disagreeing.”

Zhao Yueling contributed to this article.

Corrections & Amplifications
A photo caption in an earlier version of this article misspelled the name of a dog, Ruthie, as Routhie. (Corrected on April 4.)