Companies are losing the urge to go public, despite a buoyant stock market, choosing instead to be acquired by corporate or private-equity suitors.

Cybersecurity company Tenable Network Security Inc. has managed to raise plenty of capital without an initial public offering, and loanDepot Inc. shelved plans for an IPO last year. Craft brewer Ballast Point Brewing & Spirits Inc., meanwhile, sold itself to wine and spirits maker Constellation Brands Inc.

So...