The common bile duct is formed by the union of the common hepatic duct (which drains bile from the liver) and the cystic duct (which drains bile from the gallbladder). The common bile duct merges with the pancreatic duct to form the hepatopancreatic ampulla, which empties into the duodenum.