Segmentation of prostate is highly important in the external beam radiotherapy of prostate cancer. However, it is challenging to localize prostate in the CT images due to low image contrast, prostate motion, and both intensity and shape changes of bladder and rectum around the prostate. In this paper, an online learning and patient-specific classification method based on location-adaptive image context is proposed to precisely segment prostate in the CT image. Specifically, two sets of position-adaptive classifiers are respectively placed along the two coordinate directions, and further trained with the previous segmented treatment images to jointly perform the prostate segmentation. In particular, each location-adaptive classifier is recursively trained with different image context collected at different scales and orientations for better identification of each prostate region. The proposed learning-based prostate segmentation method has been extensively evaluated on a large set of patients, achieving very promising results.