PLAINVIEW, N.Y.—It looks more like a warehouse than a Long Island burger joint, but the Bareburger restaurant on a busy intersection here is attracting patrons for its food—and its architecture.

The restaurant, which opened last year, is made of 11 truck-size containers previously used by Japanese shipping company NYK Line. Bareburger Group LLC worked with SG Blocks Inc., which specializes in container-based buildings and has designed similar structures for Starbucks Corp., SBUX -1.84% Yum Brands Inc.’s Taco Bell restaurants and Lacoste stores.

“It came naturally,” says John Simeonidis Jr., Bareburger’s co-founder and chief design officer. “We use reclaimed wood for floors and tables, recycled vinyl for seats and so on. So we said, ‘let’s think outside the box for the structure’ and ended up building a metal box that looks really cool.”

Shipping containers, typically 20 or 40 feet long, are the workhorses of freight transportation, used to move most of the world’s manufactured goods. Shipping companies pay about $2,000 to $3,000 for each one, with an average container lasting 18 years before it is retired from sea.

More of these used containers are finding second lives as building materials, popping up in restaurant chains like Bareburger as well as private homes, theme parks, swimming pools and prison cells.

Rune Sorensen of Maersk Line says the shipping company sold 70,000 used containers for $1,000 to $1,300 apiece last year. Photo: Maersk

Although such structures are becoming more popular for their trendy looks, they aren’t about to replace traditional buildings, construction executives say.

Containers must be cut when stacked to widen the living space or to create windows and doors, and need to be insulated from the inside and reinforced with steel beams in multistory structures. And after they are put together, conversions or expansions are difficult and expensive.

About 1 million containers a year are sold or leased for inland use, shipping executives say. Maersk Line, a unit of Danish conglomerate A.P. Moller Maersk A/S with 2.7 million containers in use world-wide, sold 70,000 of them for $1,000 to $1,300 apiece last year, said Rune Sorensen, the unit’s head of container sales.

That was double the amount it sold in 2015, he said, and he expects the growth to continue in the coming years. The market, he added, “is still discovering itself.”

In Brooklyn’s Williamsburg neighborhood, architecture studio LOT-EK stacked 21 containers, then cut the structure diagonally to create a three-story, 5,000-square-foot single-family home.

“It must be one of the most photographed houses in Brooklyn,” says Simon Araya, who works at a nearby cafe. “In the beginning it stood out like a sore thumb, but it does fit Williamsburg’s hipster and artistic culture.”

LOT-EK has used containers on other projects, including Qiyun Mountain Camp, a 60-acre extreme-sports park in Huangshan, China, scheduled to open later this year, and a seven-story apartment block in Johannesburg, South Africa, using 140 metal boxes. Slated for completion this summer, it is expected to be the world’s biggest container structure.

Ada Tolia, one of LOT-EK’s co-founders, described containers as “the most prominent symbols of globalization, that move just about everything we own on ships, trucks or trains.”

Once they have been retired from their primary use, she said, “they can be used as Lego blocks that can be stacked or shaped to make the most efficient, lightweight and strong structures.”

Elsewhere, their second lives are more mundane. New York public-works contractors stack them up as temporary support for overpasses, while Australia’s Department of Correctional Services uses them for prison cells. Containers also are used as temporary structures in seasonal or remote locations by retailers, medical clinics, energy workers and the military.

More in Logistics Get the latest news and analysis on logistics and supply-chain issues via a daily newsletter, at WSJ.com/Logistics. XPO Logistics Adjusts Guidance Off Customer Bankruptcy

The United Nations uses containers in Haiti as a secure, weather-resistant way of storing food, water, medicine and other equipment.

“When Hurricane Matthew hit the island last October, it was tremendously useful to have hurricane-response gear stored and pre-positioned in shipping containers,” said U.S. Air Force Maj. Andrew J. Schrag, who participated in the U.N. peacekeeping deployment. “Containers performed tremendously and enabled the ‘Blue Helmets’ to be much more effective in preventing a prolonged human catastrophe in the aftermath of the hurricane.”

Industry executives say building with containers can be 40% faster and 20% cheaper than using traditional building materials, though Bareburger ultimately paid double what it budgeted for the Plainview restaurant. The project cost about $2 million and took four years from conception to completion, with builders struggling to work with the dented metal and inspectors conducting extensive reviews before approving the construction.

“It was a massive learning curve,” Mr. Simeonidis said. “It was a new way of building that builders on site had no feel for.”

At Bareburger, “We use reclaimed wood for floors and tables, recycled vinyl for seats and so on. So we said, ‘let’s think outside the box for the structure,’” said co-founder John Simeonidis Jr. Photo: Costa Paris/The Wall Street Journal

Write to Costas Paris at costas.paris@wsj.com