Inshore containers in high resolution optical imagery are under severe interference, such as structure, shadow, and environment, and the ship bodies are very similar to the container structures on nearby land. These situations make the automatic detection of inshore containers a very challenging task. In order to address this problem, this paper proposes a detection method for inshore containers based on the superpixel-level contextual feature. Firstly, the image is segmented into superpixels, and the features of the superpixel and its neighboring superpixels are concatenated into the superpixel-level contextual feature. Then, based on the positive samples and the actively selected negative samples, the target and the background superpixels are classified via machine learning. Finally, the fully connected conditional random field is employed to refine the classification result and realize the detection. The experimental result verifies the applicability of the proposed method.