Sonar is the primary tool used for detecting small targets at long distances underwater. Due to the influence of the underwater environment and imaging mechanisms, sonar images face challenges such as a small number of target pixels, insufficient data samples, and uneven category distribution. Existing target detection methods are unable to effectively extract features from sonar images, leading to high false positive rates and affecting the accuracy of target detection models. To counter these challenges, this paper presents a novel sonar small-target detection framework named DCE-Net that refines the YOLOv8 architecture. The Detail Enhancement Attention Block (DEAB) utilizes multi-scale residual structures and channel attention mechanism (AM) to achieve image defogging and small-target structure completion. The lightweight spatial variation convolution module (CoordGate) reduces false detections in complex backgrounds through dynamic position-aware convolution kernels. The improved efficient multi-scale AM (MH-EMA) performs scale-adaptive feature reweighting and combines cross-dimensional interaction strategies to enhance pixel-level feature representation. Experiments on a self-built sonar small-target detection dataset show that DCE-Net achieves an mAP@0.5 of 87.3% and an mAP@0.5:0.95 of 41.6%, representing improvements of 5.5% and 7.7%, respectively, over the baseline YOLOv8. This demonstrates that DCE-Net provides an efficient solution for underwater detection tasks.