Cooperative edge computing serves as an effective solution to provide reliable and elastic edge computing services through pooling geographically proximate edge resources and efficiently allocating them to users. The incentive mechanism is critical for realizing cooperative edge computing. In this paper, we propose a virtual machine (VM) or container based resource allocation scheme and two market-based mechanisms to stimulate collaboration among edge servers (ESs). Our first mechanism is a novel two-stage double auction based approach where edge resources are allocated to services/VMs at the first stage and then distributed among ESs at the second stage via a two-sided multi-unit auction. To make it more practical, we use markups to set the ask and bid prices for the participants in the market. Moreover, with the concept of virtual sellers and virtual buyers, we cast the multi-unit auction as single-unit one so that the auction becomes tractable. We further propose a price-based decentralized mechanism in case there is no central authority. With an appropriately constructed objective function, we formulate the resource allocation task as a network utility maximization (NUM) problem and leverage the dual-based decomposition theory for a distributed solution. We theoretically prove that both mechanisms guarantee properties such as budget balance and individual rationality for all ESs. Numerical studies with real-world dataset are presented to demonstrate the superior performance of our mechanisms over baselines.