OAKLAND, Calif. — This summer, the median rent for a one-bedroom in San Francisco’s cityscape of peaked Victorians soared higher than Manhattan’s, sent skyward by a housing shortage fueled in part by the arrival of droves of newcomers here to mine tech gold.

And so, as the story of such cities goes, the priced-out move outward — in New York City, to Brooklyn and, increasingly, to Queens. For San Franciscans, the rent refuge is here in Oakland, where the rates are increasing as well — so much so that young professionals are living in repurposed shipping containers while the homeless are lugging around coffinlike sleeping boxes on wheels.

These two improvised housing arrangements have emerged in an industrial pocket of Oakland where the median rent has gone up by 20 percent over the past year. One, in a warehouse, is called Containertopia, a community of young people who have set up a village of 160-square-foot shipping containers like ones used in the Port of Oakland. Each resident pays $600 a month to live in a container, which can be modified with things like insulation, glass doors, electrical outlets, solar panels and a self-contained shower and toilet.

Containertopia was started last year by Luke Iseman, 32, and Heather Stewart, 30, who were then a couple. For Mr. Iseman, who graduated from the University of Pennsylvania’s Wharton School and works in technology — most recently developing automated systems for watering plants — container living has been a social experiment in stripping down to the basics, one that he hopes to teach others to replicate.

“If we can do it in one of the highest-cost places in the world,” he said, “people can do this anywhere.”

Just outside the warehouse doors is another community, residing, too, in containers of a sort. Here, the homeless live in dwellings made by a local artist named Gregory Kloehn, set on wheels and made for the streets. Each is about eight feet long and tall enough for a person to sit up in.

“It doesn’t fit our mind-set of what a home is,” said Mr. Kloehn, 44, who began creating and giving away the portable homes, which are made of recycled material, in 2011. Oakland has about 3,000 homeless people, according to the East Oakland Community Project, a nonprofit organization that helps house people who live on the street; San Francisco has about 6,700.

Mr. Kloehn has made about 40 of the cheerily painted rolling boxes, coaxing people to leave their cardboard or tarp shanties on the streets.

“In this city, with all its money, within it there is another layer: these nomadic people who are living off our garbage,” he said.

Containertopia and Mr. Kloehn’s mobile shelters draw from the tiny house movement, a shift to a more ascetic way of living that has inspired entire microhome villages in places like Olympia, Wash., and Madison, Wis., as well as isolated examples in countless backyards. Such residences are embraced by the ecologically and social-justice minded, but are often fought by local governments; they often do not comply with building codes or are plopped in areas where they should not be.

But that is where the similarities between the homeless dwellings and the shipping containers end. Though they are on the same block, they are worlds apart.

Ms. Stewart and Mr. Iseman initially set Containertopia in an abandoned lot in the area, which they purchased for $425,000 with several friends. They were forced out this spring after neighbors complained. (The lot is not zoned for residences; for now, the owners grow vegetables there while they decide what to do with it.)

Then, with 12 of their friends and a forklift, Mr. Iseman and Ms. Stewart moved the container homes indoors to a warehouse. Mr. Iseman’s container, painted azure inside, cost about $12,000 to make habitable, with a lofted bed and a picture window carved into one flank. Ms. Stewart is still at work on hers, spackling drywall and carving a kitchen countertop from a redwood board she milled from a giant trunk.

The shift from house to container dwelling has made them reprioritize almost everything. Ms. Stewart quit her job in digital design to manage Containertopia and sold most of her possessions.

“I can work an office job and pay my rent every month and be stressed about not being able to do anything else, or I can live in a ridiculous warehouse,” she said. “The choice is obvious.”

Mr. Kloehn, the artist, is best known for his own container home, a Dumpster turned studio apartment on the lot of an arts collective in Red Hook, Brooklyn, where he spends part of the year. His other home is a studio in Oakland in the same industrial neighborhood as Containertopia.

Several years ago, Mr. Kloehn became fascinated with how homeless people appropriated what few resources they had — namely, other people’s trash — to create shelters. He decided to do the same, cobbling the small dwellings together with an artist’s skill.

“I’m just kind of ripping a page from the homeless people’s books,” he said. “They’ve been making homes out of this stuff for a long time.”

Another artist, Elvis Summers, started making similar tiny homes for the homeless around Los Angeles. But that city determined those homes were illegal; many of the structures were moved onto private property before sanitation workers could remove them from the streets.

Mr. Kloehn says that cracking down on the boxes is misguided. If the box homes were banned, “would they be in an apartment?” he asked of the dwellers. “Would they be in a condo? Or would they be nowhere?”

In Oakland, the portable houses have been largely tolerated. Several residents said they were occasionally asked by the police to wheel them elsewhere, but were otherwise left alone.

A block from Mr. Kloehn’s studio, and around the corner from Containertopia, sits one of his homes for the homeless, brightly colored with a trompe l’oeil paint job that makes it look like a microsize suburban home.

“This house is a blessing,” the woman living in it said. She declined to give her name because she said she was ashamed she lived on the streets, having once had a steady job and a real home.

She added, “This is my way of trying to get back to how I used to be.”